From: newportri on
Greetings
I am having an issue with a form submission action page- I can get it to send
the field contents to an email, and capture in a DB with the same action page-
but when an file is chosen to upload, it fails.

I need to have cfinsert, cfmail to, and cffile action = "upload" on the same
action page. The submitter may or may not upload a file with the submission, so
I tried <cfif isDefined("Form.FileContents") > upload the file</cfif>, then
insert in DB, then send the email.

Any help would be appreciated- Thanks

newportri

From: Dan Bracuk on
cfdump is your freind.

submit your form without uploading a file. then do this

<cfdump var="#isDefined('Form.FileContents') "#>
<cfdump var="#Form.#">
<cfabort>

From: newportri on
Thanks for your quick response- It may be easier to show the code on the action
page, then you can suggest a fix because I don't know why I'd dump the
variables?

The Submitter is not required to upload a file with their submission (They
may or may not).

ACTION PAGE:

<cfif isDefined("Form.FileContents") >
<cffile action = "upload"
filefield = "FileContents"
destination = "c:\Inetpub\wwwroot\whatever\"
accept =
"image/jpg,image/jpeg,image/pjpeg,image/gif,text/anytext,application/octet-strea
m"
nameConflict = "MakeUnique"> </cfif>



<cfinsert datasource="whatever" tablename="whatever">


<cfmail to="whatever(a)whatever.com"
from="#Form.request_email#"
subject="whatever"
server ="whatever">


The following is the result of a Form Submission:

Date: #dte_received#
Time: #tme_received#

ETC.
</cfmail>

<html>
<head>
<title> Form Submission</title>
</head

<body>
<h3>Thank You For Your Submission</h3>
</body>
</html>

Thanks...

newportri

From: Dan Bracuk on
Dumping variables is a debugging technique. Once you have solved the problem, you take out the dump tags.
From: ghfftttyyudsderycv76 on

How's your FORM written? Did you have the enctype="multipart/form-data" Attribute?


 |  Next  |  Last
Pages: 1 2
Prev: Word /excel to pdf
Next: Analyzing an Indesign file