0
The form field arguments.image did not contain a file.
Engaged
,
/t5/coldfusion-discussions/the-form-field-arguments-image-did-not-contain-a-file/td-p/267771
Jul 23, 2007
Jul 23, 2007
Copy link to clipboard
Copied
Hi there,
I'm getting a strange error with a simple file upload and I can't figure it out for the life of me. It's odd, because old code I have written before has worked fine in this area, and I really honestly can't see where I am going wrong.
First the error:
The form field arguments.image did not contain a file.
The error occurred in C:\ColdFusion8\wwwroot\red_roof_rentals\components\query.cfc: line 37
35 :
36 : <!---<cftry>--->
37 : <cffile action="upload" accept="image/jpg,image/jpeg,image/gif" filefield="arguments.image" nameconflict="overwrite" destination="#getDirectoryFromPath(getBaseTemplatePath())#\properties\">
38 : <cfset variables.image = "#file.ServerFile#" />
39 : <cfset variables.thumb = "thumb_#file.ServerFile#" />
I have researched this and found other people have had the same problem - although please be aware that I do not beleive this to be an issue with whatever version of CF I am running. I have still not found an answer.
I have one template with my form called "admin_create_property.cfm". When the form posts it invokes a CFC method that uploads the file and inserts stuff into the database. However, it dies at the file upload part with that bizzarre error.
There are only two files working in this:
admin_create_property.cfm
query.cfc
I will write the code out for these so you can see. Please see attached code. Please note that I have taken out as much irrelevant code as possible (html, doctypes etc etc).
Any help with this would be greatly appreciated as I am absolutley stumped to be quite honest. I've heard people say it could be any of the following:
1 - Need to use enctype="multipart/form-data" - which I DO
2 - cffile filefield can't contain ## - which it DOESN'T
3 - Inut type must be file - which it clearly is.
Please please help, I feel stupid asking about this but I need you guys more than ever!
Kind regards and thanks in advance,
Mikey.
I'm getting a strange error with a simple file upload and I can't figure it out for the life of me. It's odd, because old code I have written before has worked fine in this area, and I really honestly can't see where I am going wrong.
First the error:
The form field arguments.image did not contain a file.
The error occurred in C:\ColdFusion8\wwwroot\red_roof_rentals\components\query.cfc: line 37
35 :
36 : <!---<cftry>--->
37 : <cffile action="upload" accept="image/jpg,image/jpeg,image/gif" filefield="arguments.image" nameconflict="overwrite" destination="#getDirectoryFromPath(getBaseTemplatePath())#\properties\">
38 : <cfset variables.image = "#file.ServerFile#" />
39 : <cfset variables.thumb = "thumb_#file.ServerFile#" />
I have researched this and found other people have had the same problem - although please be aware that I do not beleive this to be an issue with whatever version of CF I am running. I have still not found an answer.
I have one template with my form called "admin_create_property.cfm". When the form posts it invokes a CFC method that uploads the file and inserts stuff into the database. However, it dies at the file upload part with that bizzarre error.
There are only two files working in this:
admin_create_property.cfm
query.cfc
I will write the code out for these so you can see. Please see attached code. Please note that I have taken out as much irrelevant code as possible (html, doctypes etc etc).
Any help with this would be greatly appreciated as I am absolutley stumped to be quite honest. I've heard people say it could be any of the following:
1 - Need to use enctype="multipart/form-data" - which I DO
2 - cffile filefield can't contain ## - which it DOESN'T
3 - Inut type must be file - which it clearly is.
Please please help, I feel stupid asking about this but I need you guys more than ever!
Kind regards and thanks in advance,
Mikey.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Explorer
,
/t5/coldfusion-discussions/the-form-field-arguments-image-did-not-contain-a-file/m-p/267772#M23748
Jul 23, 2007
Jul 23, 2007
Copy link to clipboard
Copied
When you say filefield="arguments.image" you are telling CF
that the file can be found in that field. CF always looks for this
file in the Form scope so you are telling CF the the file is
located in the variable Form[arguments.image]. You need to pass the
name of the Form field to your function such that :
<cffile formfield="#arguments.image#" ...... />
where arguments.image = "image"
[Edited]
ie this should be
<cfinvokeargument name="image" value="image" />
<cffile formfield="#arguments.image#" ...... />
where arguments.image = "image"
[Edited]
ie this should be
<cfinvokeargument name="image" value="image" />
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Kapitaine
AUTHOR
Engaged
,
/t5/coldfusion-discussions/the-form-field-arguments-image-did-not-contain-a-file/m-p/267774#M23750
Jul 24, 2007
Jul 24, 2007
Copy link to clipboard
Copied
I don't get what you mean as this is what I am doing.
<cfinvokeargument name="image" value="#form.image#" />
This takes the value of the image file field and passes it to the CFC as an argument.
Am I doing something wrong with this? Sorry for my stupidness!
Thanks for you help, further assistance would be greatly appreciated.
EDIT: Interestingly enough, if I just use the tag on my "admin_create_property.cfm" page instead of using the CFC method like this...
<cffile action="upload" accept="image/jpg,image/jpeg,image/gif" filefield="form.image" nameconflict="overwrite" destination="#getDirectoryFromPath(getBaseTemplatePath())#\properties\">
It seems to upload the image just fine. Why then would this not work if all I am doing is simply passing to the CFC the value of the "form.image" as an argument so that the file upload can happen in my CFC instead of in the calling template??!
It's really bizzarre.
Mikey.
<cfinvokeargument name="image" value="#form.image#" />
This takes the value of the image file field and passes it to the CFC as an argument.
Am I doing something wrong with this? Sorry for my stupidness!
Thanks for you help, further assistance would be greatly appreciated.
EDIT: Interestingly enough, if I just use the tag on my "admin_create_property.cfm" page instead of using the CFC method like this...
<cffile action="upload" accept="image/jpg,image/jpeg,image/gif" filefield="form.image" nameconflict="overwrite" destination="#getDirectoryFromPath(getBaseTemplatePath())#\properties\">
It seems to upload the image just fine. Why then would this not work if all I am doing is simply passing to the CFC the value of the "form.image" as an argument so that the file upload can happen in my CFC instead of in the calling template??!
It's really bizzarre.
Mikey.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Explorer
,
/t5/coldfusion-discussions/the-form-field-arguments-image-did-not-contain-a-file/m-p/267773#M23749
Jul 23, 2007
Jul 23, 2007
Copy link to clipboard
Copied
see above
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Kapitaine
AUTHOR
Engaged
,
/t5/coldfusion-discussions/the-form-field-arguments-image-did-not-contain-a-file/m-p/267775#M23751
Jul 24, 2007
Jul 24, 2007
Copy link to clipboard
Copied
I have figured this out.
It seems that when you pass the field to an argument in the CFC it doesn't like the prefixed "arguments" and so it should just be "image" instead of "arguments.image".
This is very strange behaviour and not very intuitive. It seems a lot of people have stumbled upon this same error. Perhaps CF could display a more useful message in future?
Anyway, it's all thanks to this thread:
http://www.fusebox.org/forums/messageview.cfm?catid=27&threadid=5977
Thanks everyone for their help.
Regards,
Mikey.
It seems that when you pass the field to an argument in the CFC it doesn't like the prefixed "arguments" and so it should just be "image" instead of "arguments.image".
This is very strange behaviour and not very intuitive. It seems a lot of people have stumbled upon this same error. Perhaps CF could display a more useful message in future?
Anyway, it's all thanks to this thread:
http://www.fusebox.org/forums/messageview.cfm?catid=27&threadid=5977
Thanks everyone for their help.
Regards,
Mikey.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Explorer
,
LATEST
/t5/coldfusion-discussions/the-form-field-arguments-image-did-not-contain-a-file/m-p/267776#M23752
Jul 24, 2007
Jul 24, 2007
Copy link to clipboard
Copied
Look here:
http://livedocs.adobe.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=ColdFu...
The Description of the filefield attribute is
Name of form field used to select the file. Do not use number signs (#) to specify the field name.
meaning that the code should be
<cfinvokeargument name="image" value="image" />
And in your function it should be:
<cffile formfield="#arguments.image#" ...... />
In the code you show above, there is no point in passing the argument image. It is not being used. The cffile tag is looking directly at FORM.image.
http://livedocs.adobe.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=ColdFu...
The Description of the filefield attribute is
Name of form field used to select the file. Do not use number signs (#) to specify the field name.
meaning that the code should be
<cfinvokeargument name="image" value="image" />
And in your function it should be:
<cffile formfield="#arguments.image#" ...... />
In the code you show above, there is no point in passing the argument image. It is not being used. The cffile tag is looking directly at FORM.image.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

