I am using this code
<CFSET thisPath= ExpandPath("*.*"
>
<CFSET imgDirectory= GetDirectoryFromPath(thisPath)>
<CFIF IsDefined("FORM.p_picture"
>
<CFTRY>
<!--- Upoad File --->
<CFFILE ACTION="UPLOAD"
FILEFIELD="FORM.p_picture"
DESTINATION="#imgDirectory#"
NAMECONFLICT="Overwrite"
ACCEPT="image/pjpeg,image/jpeg,image/gif">
<!--- Rename Img --->
<CFFILE ACTION="RENAME"
SOURCE="#CFFILE.ServerDirectory#\#CFFILE.ServerFile#"
DESTINATION="#CFFILE.ServerDirectory#\pictures\pic#p_id#.#CFFILE.ServerFileExt#">
<cfset picture="pic#p_id#.#CFFILE.ServerFileExt#">
<!--- Catch error, if it's not a jpg or gif file --->
<CFCATCH TYPE="Any">
I'm sorry, you must upload a .gif or .jpg file.
</CFCATCH>
</CFTRY>
</CFIF>
</cfoutput>
and if I do not send anything through the form it does not apply the isdefined condition hence giving me an error.
Users might want to update just the name without having to upload the picture again. How can I tell the upload and the query to ignor the field if it is not there?????
<CFSET thisPath= ExpandPath("*.*"
<CFSET imgDirectory= GetDirectoryFromPath(thisPath)>
<CFIF IsDefined("FORM.p_picture"
<CFTRY>
<!--- Upoad File --->
<CFFILE ACTION="UPLOAD"
FILEFIELD="FORM.p_picture"
DESTINATION="#imgDirectory#"
NAMECONFLICT="Overwrite"
ACCEPT="image/pjpeg,image/jpeg,image/gif">
<!--- Rename Img --->
<CFFILE ACTION="RENAME"
SOURCE="#CFFILE.ServerDirectory#\#CFFILE.ServerFile#"
DESTINATION="#CFFILE.ServerDirectory#\pictures\pic#p_id#.#CFFILE.ServerFileExt#">
<cfset picture="pic#p_id#.#CFFILE.ServerFileExt#">
<!--- Catch error, if it's not a jpg or gif file --->
<CFCATCH TYPE="Any">
I'm sorry, you must upload a .gif or .jpg file.
</CFCATCH>
</CFTRY>
</CFIF>
</cfoutput>
and if I do not send anything through the form it does not apply the isdefined condition hence giving me an error.
Users might want to update just the name without having to upload the picture again. How can I tell the upload and the query to ignor the field if it is not there?????