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="addpic.cfm" METHOD="POST" ENCTYPE="multipart/form-data">
<EM>*</EM> Character's Name:<INPUT TYPE="TEXT" NAME="Name"><BR>
<EM>*</EM> File:<INPUT TYPE="FILE" NAME="Pic1"><BR>
File:<INPUT TYPE="FILE" NAME="Pic2"><BR>
File:<INPUT TYPE="FILE" NAME="Pic3"><BR>
<H6>NOTE: Files must be in type .jpg or .gif format</H6><BR>
<INPUT TYPE="SUBMIT">
the file processing the form:
<CFIF NOT ISDEFINED("form.name"
>
You must supply at least the character's name of who this picture is of!
<CFABORT>
<CFELSEIF NOT ISDEFINED("form.Pic1"
>
Why fill out the form if your not even going to add a picture?
<CFABORT>
</CFIF>
<CFFILE
ACTION="UPLOAD"
FILEFIELD="Pic1"
ACCEPT="image/pjpeg, image/pjpg, image/jpeg, image/jpg, image/pgif, image/gif"
DESTINATION="E:\inetpub\NAMECONFLICT="ERROR">
<CFSET FORM.Pic1 = "#File.ServerFile#">
<CFIF "form.pic2" IS NOT "">
<CFFILE
ACTION="UPLOAD"
FILEFIELD="Pic2"
ACCEPT="image/pjpeg, image/pjpg, image/jpeg, image/jpg, image/pgif, image/gif"
DESTINATION="E:\inetpub\NAMECONFLICT="ERROR">
<CFSET FORM.Pic2 = "#File.ServerFile#">
<CFELSE>
<CFSET FORM.Pic2 = "NA">
</CFIF>
<CFIF "form.pic3" IS NOT "">
<CFFILE
ACTION="UPLOAD"
FILEFIELD="Pic3"
ACCEPT="image/pjpeg, image/pjpg, image/jpeg, image/jpg, image/pgif, image/gif"
DESTINATION="E:\inetpub\NAMECONFLICT="ERROR">
<CFSET FORM.Pic3 = "#File.ServerFile#">
<CFELSE>
<CFSET FORM.Pic3 = "NA">
</CFIF>
<
CFINSERT
DATASOURCE="db"
TABLENAME="pics"
>
I have tried changing it to read:
<CFIF ISDEFINED("Form.Pic3"
>
then the rest
no matter what it seems that when a <INPUT TYPE="FILE" 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!
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="addpic.cfm" METHOD="POST" ENCTYPE="multipart/form-data">
<EM>*</EM> Character's Name:<INPUT TYPE="TEXT" NAME="Name"><BR>
<EM>*</EM> File:<INPUT TYPE="FILE" NAME="Pic1"><BR>
File:<INPUT TYPE="FILE" NAME="Pic2"><BR>
File:<INPUT TYPE="FILE" NAME="Pic3"><BR>
<H6>NOTE: Files must be in type .jpg or .gif format</H6><BR>
<INPUT TYPE="SUBMIT">
the file processing the form:
<CFIF NOT ISDEFINED("form.name"
You must supply at least the character's name of who this picture is of!
<CFABORT>
<CFELSEIF NOT ISDEFINED("form.Pic1"
Why fill out the form if your not even going to add a picture?
<CFABORT>
</CFIF>
<CFFILE
ACTION="UPLOAD"
FILEFIELD="Pic1"
ACCEPT="image/pjpeg, image/pjpg, image/jpeg, image/jpg, image/pgif, image/gif"
DESTINATION="E:\inetpub\NAMECONFLICT="ERROR">
<CFSET FORM.Pic1 = "#File.ServerFile#">
<CFIF "form.pic2" IS NOT "">
<CFFILE
ACTION="UPLOAD"
FILEFIELD="Pic2"
ACCEPT="image/pjpeg, image/pjpg, image/jpeg, image/jpg, image/pgif, image/gif"
DESTINATION="E:\inetpub\NAMECONFLICT="ERROR">
<CFSET FORM.Pic2 = "#File.ServerFile#">
<CFELSE>
<CFSET FORM.Pic2 = "NA">
</CFIF>
<CFIF "form.pic3" IS NOT "">
<CFFILE
ACTION="UPLOAD"
FILEFIELD="Pic3"
ACCEPT="image/pjpeg, image/pjpg, image/jpeg, image/jpg, image/pgif, image/gif"
DESTINATION="E:\inetpub\NAMECONFLICT="ERROR">
<CFSET FORM.Pic3 = "#File.ServerFile#">
<CFELSE>
<CFSET FORM.Pic3 = "NA">
</CFIF>
<
CFINSERT
DATASOURCE="db"
TABLENAME="pics"
>
I have tried changing it to read:
<CFIF ISDEFINED("Form.Pic3"
then the rest
no matter what it seems that when a <INPUT TYPE="FILE" 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!