ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 1st, 2006, 05:57 PM
nathantruant nathantruant is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2006
Posts: 5 nathantruant User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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

Reply With Quote
  #2  
Old April 1st, 2006, 05:59 PM
nathantruant nathantruant is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2006
Posts: 5 nathantruant User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 22 m 45 sec
Reputation Power: 0
Never mind =] I added a AND FORM.ImageUpload NEQ ""> and it works fine now.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Optional File Upload


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT