Hi all,

I have a form which includes a file field, however this is an optional field
for the user.  The 'insert.cfm' page checks to see if the user has selected
a file and if so gets the name of it and all the other form data and inserts
it into a database.  The problem I'm having is what code I need to use as an
'else' (if the user hasn't selected a file to upload) - everything I've
tried so far is giving me an access violation.  Code for the 'insert.cfm'
page is below....any help would really be appreciated!

Thanks,

Lee


<!--- Upload File Attachment, check if user has selected a file first --->
<cfif Len(Trim(form.file_rfq)) GT 0>
<CFFILE action="UPLOAD" FILEFIELD="file_rfq"
DESTINATION="d:\webserver\mysite\www\uploads\" NAMECONFLICT="makeunique">
</cfif>
<!--- End Insert --->
<!--- SQL Insert Statement - After Upload & If user selected a file to
upload --->
<cfif Len(Trim(form.file_rfq)) is not 0>
<CFQUERY DATASOURCE="datasourcename">
INSERT INTO rfqs(rfq_fullname,
     rfq_companyname,
     rfq_email,
     rfq_tel,
     project_name,
     project_scope,
     budget,
     timescale,
     file_rfq)
VALUES('#Trim(FORM.rfq_fullname)#',
  '#Trim(FORM.rfq_companyname)#',
  '#Trim(FORM.rfq_email)#',
  '#Trim(FORM.rfq_tel)#',
  '#Trim(FORM.project_name)#',
  '#Trim(FORM.project_scope)#',
  '#Trim(FORM.budget)#',
  '#Trim(FORM.timescale)#',
  '#Trim(CFFILE.SERVERFILE)#')

</CFQUERY>
</cfif>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to