Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFFILE Help Please (code included)

Status
Not open for further replies.

bboehle

Programmer
Aug 22, 2000
24
US
I'm trying to make a page where it will allow the user to upload 3 files.. but only HAS to upload 1. Right now if they don't upload 3 files they get this error:

Error Diagnostic Information
Error processing CFFILE

No data was received in the uploaded file '\.' Saving empty (zero-length) files is prohibitted. Please make sure you specified the correct file.

The error occurred while processing an element with a general identifier of (CFFILE), occupying document position (53:1) to (58:21).

This was because the third file box was left blank. Here is the code I have currently...
The form itself:

<FORM ACTION=&quot;addpic.cfm&quot; METHOD=&quot;POST&quot; ENCTYPE=&quot;multipart/form-data&quot;>
<EM>*</EM> Character's Name:<INPUT TYPE=&quot;TEXT&quot; NAME=&quot;Name&quot;><BR>
<EM>*</EM> File:<INPUT TYPE=&quot;FILE&quot; NAME=&quot;Pic1&quot;><BR>
  File:<INPUT TYPE=&quot;FILE&quot; NAME=&quot;Pic2&quot;><BR>
  File:<INPUT TYPE=&quot;FILE&quot; NAME=&quot;Pic3&quot;><BR>
<H6>NOTE: Files must be in type .jpg or .gif format</H6><BR>
<INPUT TYPE=&quot;SUBMIT&quot;>

the file processing the form:

<CFIF NOT ISDEFINED(&quot;form.name&quot;)>
You must supply at least the character's name of who this picture is of!
<CFABORT>
<CFELSEIF NOT ISDEFINED(&quot;form.Pic1&quot;)>
Why fill out the form if your not even going to add a picture?
<CFABORT>
</CFIF>
<CFFILE
ACTION=&quot;UPLOAD&quot;
FILEFIELD=&quot;Pic1&quot;
ACCEPT=&quot;image/pjpeg, image/pjpg, image/jpeg, image/jpg, image/pgif, image/gif&quot;
DESTINATION=&quot;E:\inetpub\NAMECONFLICT=&quot;ERROR&quot;>
<CFSET FORM.Pic1 = &quot;#File.ServerFile#&quot;>
<CFIF &quot;form.pic2&quot; IS NOT &quot;&quot;>
<CFFILE
ACTION=&quot;UPLOAD&quot;
FILEFIELD=&quot;Pic2&quot;
ACCEPT=&quot;image/pjpeg, image/pjpg, image/jpeg, image/jpg, image/pgif, image/gif&quot;
DESTINATION=&quot;E:\inetpub\NAMECONFLICT=&quot;ERROR&quot;>
<CFSET FORM.Pic2 = &quot;#File.ServerFile#&quot;>
<CFELSE>
<CFSET FORM.Pic2 = &quot;NA&quot;>
</CFIF>
<CFIF &quot;form.pic3&quot; IS NOT &quot;&quot;>
<CFFILE
ACTION=&quot;UPLOAD&quot;
FILEFIELD=&quot;Pic3&quot;
ACCEPT=&quot;image/pjpeg, image/pjpg, image/jpeg, image/jpg, image/pgif, image/gif&quot;
DESTINATION=&quot;E:\inetpub\NAMECONFLICT=&quot;ERROR&quot;>
<CFSET FORM.Pic3 = &quot;#File.ServerFile#&quot;>
<CFELSE>
<CFSET FORM.Pic3 = &quot;NA&quot;>
</CFIF>
<
CFINSERT
DATASOURCE=&quot;db&quot;
TABLENAME=&quot;pics&quot;
>


I have tried changing it to read:

<CFIF ISDEFINED(&quot;Form.Pic3&quot;)>
then the rest

no matter what it seems that when a <INPUT TYPE=&quot;FILE&quot; is there but not used it defines something other then an empty field.. but I can't figure it out :/

Any help would be very much appreciated!

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top