This content has been marked as final. Show 3 replies
The file does not get uploaded and instead it loads a description of the
cfc and all the methods. No error so I can't tell what is wrong. How
do I get this to work? Anyone have any ideas?
If you are getting the description of the CFC and it's methods, then CF
is running the Component Explorer, which is the default behavior if one
access a CFC directly with an URL.
When I use a CFC as an action for a post form, I put the method in as a
hidden field rather then an URL parameter. You could give that a try.
<input type="hidden" name="method" value="uploadPicture">
I removed the ?method=uploadPicture from the action attribute and added the hidden variable but now I am getting this message:
Invalid content type: "".
CFFILE action="upload" requires forms to use enctype="multipart/form-data".
The error occurred in D:\www\CMS\CFCs\cmsBios.cfc: line 511
509 : <cfdirectory action="create" directory="#uploadPath#">
510 : </cfif>
511 : <cffile action="upload" fileField="UploadFile" destination="#uploadPath#" nameConflict="MakeUnique">
512 : <script>
513 : refreshParent();
I have the enctype set to multipart/form-data. Also does the cfc know which method to use automatically from the hidden variable or do I need to specify that some how?
Also does the cfc know which method to use automatically from the hidden
variable or do I need to specify that some how?
You have to specify the method you want to use as the value of the
<input type="hidden" name="method" value="methodName">
Look at the source of the form being generated by your code. Is it
properly formated? Is there a chance that somehow the output is mangled
so that you are not getting a correct form?