Re: Cfform upload - Form Field contains no file
I have re-written the code and it is working, except that the renaming of the files (filefield=#variables.filename#) part is not working. When I dump (see code below) the session variable that I am assigning to filefield, I get the correct result, but the filename is not changed on upload when I check them at where there are stored. !--- Assign the productID to a session variable --- cflock timeout=20 scope=Session type=Exclusive cfset Session.ExtraProductImgName = URL.Cnsmr_ProductID /cflock !--testing for the value of session variable -- cfdump var=#Session.ExtraProductImgName# !---create variable to hold destination of uploaded files--- cfset upLoadDestination = #ExpandPath('images/consumer/')# cfif isdefined(form.upload) cfloop index=i from=1 to=#Session.numberoffields# step=1 cfset filename = #Session.ExtraProductImgName# #i# !--- cfif evaluate(variables.filename) neq --- cffile action=UPLOAD destination=#upLoadDestination# nameconflict=makeunique filefield=#variables.filename# !---/cfif--- /cfloop !--- Delete the session variable after uploading files related to this particular ProductID --- cflock timeout=20 scope=Session type=Exclusive cfset StructDelete(Session, ExtraProductImgName) /cflock /cfif /cfif !--- end extra upload processing --- Fawzi, Are you saying that you removed the nested cf-tags and the problem persists? If that is what you are saying, please post your new code as edited, so we can see what else might be wrong. William ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:321209 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Cfform upload - Form Field contains no file
cffile action=upload DOES NOT rename files. it just moves the uploaded file from the temp upload dir on the server to the dir on the server you specify in the DESTINATION attribute. depending on the value of NAMECONFLICT attribute, this action will either overwrite a file with the same name if it already exists in the destination folder, or will append a sequential number to the file name. to rename a file you should use cffile action=rename. Azadi Saryev Sabai-dee.com http://www.sabai-dee.com/ Fawzi Amadu wrote: I have re-written the code and it is working, except that the renaming of the files (filefield=#variables.filename#) part is not working. When I dump (see code below) the session variable that I am assigning to filefield, I get the correct result, but the filename is not changed on upload when I check them at where there are stored. !--- Assign the productID to a session variable --- cflock timeout=20 scope=Session type=Exclusive cfset Session.ExtraProductImgName = URL.Cnsmr_ProductID /cflock !--testing for the value of session variable -- cfdump var=#Session.ExtraProductImgName# !---create variable to hold destination of uploaded files--- cfset upLoadDestination = #ExpandPath('images/consumer/')# cfif isdefined(form.upload) cfloop index=i from=1 to=#Session.numberoffields# step=1 cfset filename = #Session.ExtraProductImgName# #i# !--- cfif evaluate(variables.filename) neq --- cffile action=UPLOAD destination=#upLoadDestination# nameconflict=makeunique filefield=#variables.filename# !---/cfif--- /cfloop !--- Delete the session variable after uploading files related to this particular ProductID --- cflock timeout=20 scope=Session type=Exclusive cfset StructDelete(Session, ExtraProductImgName) /cflock /cfif /cfif !--- end extra upload processing --- Fawzi, Are you saying that you removed the nested cf-tags and the problem persists? If that is what you are saying, please post your new code as edited, so we can see what else might be wrong. William ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:321210 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Cfform upload - Form Field contains no file
Take the cfoutputs out of the cfinput tag. Adrian -Original Message- From: Fawzi Amadu [mailto:abd...@gmail.com] Sent: 31 March 2009 16:54 To: cf-talk Subject: Cfform upload - Form Field contains no file My code is throwing an error the baffles me. With the code below, when I select the files I need to be uploaded, the server returns an error that says that the field contained no file, while I had been able to select a file for that field. What is wrong with my code: cfform action=uploadExtraConsumerProductImages.cfm enctype=multipart/form-data method=post cfloop index=i from=1 to=#Session.numberoffields# step=1 cfset filename = #Session.ExtraProductImgName# #i# !--- Set the respective file name for the uploaded image --- cfinput type=File name=cfoutput#variables.filename#/cfoutput /br / /cfloop cfinput type=Submit name=upload value=upload / /cfform ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:321120 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Cfform upload - Form Field contains no file
this: cfinput type=File name=cfoutput#variables.filename#/cfoutput / is just wrong. you can't nest cf tags like that, and you do not need to: cf automatically evaluates variables in cf tag attributes: cfinput type=file name=#variables.filename# will do just fine. whay cf throws that error is a different issue. my guess would be because you are giving a wrong value to FILEFIELD attribute of cffile tag on the form's action page... Azadi Saryev Sabai-dee.com http://www.sabai-dee.com/ Fawzi Amadu wrote: My code is throwing an error the baffles me. With the code below, when I select the files I need to be uploaded, the server returns an error that says that the field contained no file, while I had been able to select a file for that field. What is wrong with my code: cfform action=uploadExtraConsumerProductImages.cfm enctype=multipart/form-data method=post cfloop index=i from=1 to=#Session.numberoffields# step=1 cfset filename = #Session.ExtraProductImgName# #i# !--- Set the respective file name for the uploaded image --- cfinput type=File name=cfoutput#variables.filename#/cfoutput /br / /cfloop cfinput type=Submit name=upload value=upload / /cfform ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:321121 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Cfform upload - Form Field contains no file
I had posted my full code earlier but got no response. I would appreciate it if you can look at it as see whether your thinking about giving a wrong value to the FILEFIELD is correct. The code is at: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:59106 Thanks for your help. this: cfinput type=File name=cfoutput#variables.filename#/cfoutput / is just wrong. you can't nest cf tags like that, and you do not need to: cf automatically evaluates variables in cf tag attributes: cfinput type=file name=#variables.filename# will do just fine. whay cf throws that error is a different issue. my guess would be because you are giving a wrong value to FILEFIELD attribute of cffile tag on the form's action page... Azadi Saryev Sabai-dee.com http://www.sabai-dee.com/ Fawzi Amadu wrote: ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:321135 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Cfform upload - Form Field contains no file
I had posted my full code earlier but got no response. I would appreciate it if you can look at it as see whether your thinking about giving a wrong value to the FILEFIELD is correct. The code is at: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:59106 Thanks for your help. this: cfinput type=File name=cfoutput#variables.filename#/cfoutput / is just wrong. you can't nest cf tags like that, and you do not need to: cf automatically evaluates variables in cf tag attributes: cfinput type=file name=#variables.filename# will do just fine. whay cf throws that error is a different issue. my guess would be because you are giving a wrong value to FILEFIELD attribute of cffile tag on the form's action page... Azadi Saryev Sabai-dee.com http://www.sabai-dee.com/ Fawzi Amadu wrote: ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:321136 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Cfform upload - Form Field contains no file
Fawzi, Are you saying that you removed the nested cf-tags and the problem persists? If that is what you are saying, please post your new code as edited, so we can see what else might be wrong. William -Original Message- From: Fawzi Amadu [mailto:abd...@gmail.com] Sent: Tuesday, March 31, 2009 3:39 PM To: cf-talk Subject: Re: Cfform upload - Form Field contains no file I had posted my full code earlier but got no response. I would appreciate it if you can look at it as see whether your thinking about giving a wrong value to the FILEFIELD is correct. The code is at: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:59106 Thanks for your help. this: cfinput type=File name=cfoutput#variables.filename#/cfoutput / is just wrong. you can't nest cf tags like that, and you do not need to: cf automatically evaluates variables in cf tag attributes: cfinput type=file name=#variables.filename# will do just fine. whay cf throws that error is a different issue. my guess would be because you are giving a wrong value to FILEFIELD attribute of cffile tag on the form's action page... Azadi Saryev Sabai-dee.com http://www.sabai-dee.com/ Fawzi Amadu wrote: ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:321137 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Cfform upload - Form Field contains no file
filefield=#variables.filename# the FILEFIELD attribute of cffile tag must contain the NAME of your input type=file form element. NOT the VALUE of that field, or some arbitrary value - just the name of file input field. Azadi Saryev Sabai-dee.com http://www.sabai-dee.com/ Fawzi Amadu wrote: I had posted my full code earlier but got no response. I would appreciate it if you can look at it as see whether your thinking about giving a wrong value to the FILEFIELD is correct. The code is at: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:59106 Thanks for your help. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:321154 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4