
April 1st, 2006, 06:57 PM
|
|
Registered User
|
|
Join Date: Mar 2006
Posts: 5
Time spent in forums: 1 h 22 m 45 sec
Reputation Power: 0
|
|
|
Optional File Upload
I'm having a problem with my file upload for a site. I want the upload field to be optional, so if the user decides not to change the image for the item they are editting, they dont' have to. What's happening is when the file form is left blank I get the error:
The form field "ImageUpload" did not contain a file.
Here is the code for the changes it is to make upon the upload:
<cfif isDefined("FORM.ImageUpload")>
<cfoutput>
<cffile action="upload"
filefield="ImageUpload"
destination="#getDirectoryFromPath(ExpandPath("../../products/#ImageLocation1#/"))#"
accept="image/*"
nameconflict="overwrite">
<CFX_IMAGE ACTION="RESIZE"
FILE="#getFileFromPath(ExpandPath("../../products/#ImageLocation1#/"))##Form.ImageUpload#"
OUTPUT="#getDirectoryFromPath(ExpandPath("../../products/#ImageLocation1#/"))##FORM.SKU#sml.jpg"
QUALITY="100"
HEIGHT="145"
name="SmallSize">
<CFX_IMAGE ACTION="RESIZE"
FILE="#getFileFromPath(ExpandPath("../../products/#ImageLocation1#/"))##Form.ImageUpload#"
OUTPUT="#getDirectoryFromPath(ExpandPath("../../products/#ImageLocation1#/"))##FORM.SKU#mini.jpg"
QUALITY="100"
HEIGHT="73"
name="MiniSize">
<cffile
action = "rename"
source = "#getFileFromPath(ExpandPath("../../products/#ImageLocation1#/"))##Form.ImageUpload#"
destination = "#getDirectoryFromPath(ExpandPath("../../products/#ImageLocation1#/"))##FORM.SKU#lrg.jpg"
attributes = "normal">
</cfoutput>
</cfif>
It's almost as if my isDefined statement isn't working properly.
Any thoughts?
Thanks
|