EasyCFM.COM ColdFusion Forums / ColdFusion Applications / multipart/form-data Problems

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: multipart/form-data Problems

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts first

chrisdonkor
08-08-2009 @ 1:32 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 28
Joined: Apr 2008

Hi, I have a multipart/form-data form running on my website with a "file type" field. If this field is uploaded with an image, the form updates my db without any problem. However, if I leave the field blank, the form updates alright without displaying any errors but the information never gets updated onto my server. Below are the codes am using:

<!--- the form --->

<CFForm action="download_add_action.cfm" method="post" enctype="multipart/form-data">
<cfinput type="file" name="downloadFile" value="spacer.gif" size="25" style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; FONT-SIZE: 9px; BORDER-LEFT: 1px solid; COLOR: black; BORDER-BOTTOM: 1px solid">

<input type="Submit" value="Submit" style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; FONT-SIZE: 9px; BORDER-LEFT: 1px solid; COLOR: black; BORDER-BOTTOM: 1px solid">
</CFForm>

<!--- the action page --->
<cfif len(trim(form.downloadFile))>
   <cffile action="upload" destination="C:\CFusionMX7\wwwroot\sas\downloads" nameConflict="makeunique" fileField="Form.downloadFile" result="downloadFile">

<CFQUERY name="Add_CADCorp_Category" datasource="#dbase#" dbtype="ODBC">
INSERT INTO downloads (downloadFile)
VALUES
('#downloadFile.serverfile#')
</CFQUERY>
</cfif>

What am I now doing right?

Thanks for your help

Stay Blessed
Christian Adusu-Donkor
Managing Consultant
(DOT House: websites & beyond)


Website Designed and Developed by Pablo Varando.