Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
brettcristofer #1
CFFILE process
I'm having some difficulty using CFFILE. Basically I have a three step process
that does the following:
Form 1. Fill in form and select image and pdf file for server upload. Files
are uploaded to server so they can be atached to an e-mail using the <cfparam>
tag and then are deleted from server after attached (all in the last step).
Form 2. Preview the form contents as it will appear on web. Either Accept or
Edit form.
Form 3. If Accepted, perform DB operations and file upload/deletion.
I want to do the server upload in the final step but my selected files are not
passing to the 3rd step. I get an error that says "The form field
"Form.pdfPath" did not contain a file. " Not too familiar with <CFFILE>. An
anyone tell me what I'm doing wrong? I've included my code.
I get the upload to work if I go directly to cffile="upload" from the first
form but adding another step in the middle seems to lose the file.
Thanks for any help.
Form 1:
<form name="form" method="POST" action="form2.cfm"
enctype="multipart/form-data">
<input type="file" name="pdfPath" size="25" maxlength="100">
<input type="file" name="image" size="25" maxlength="100">
</form
Form 2:
<form name="form" method="POST" action="form3.cfm"
enctype="multipart/form-data">
<cfoutput>
<input type="hidden" name="pdfPath" id="pdfPath" value="#pdfPath#">
<input type="hidden" name="image" id="image" value="#image#">
</cfoutput>
</form>
Form 3:
<!---Mail Activation Request and File Attachments to Site Administrator
<cfif form.pdfPath neq ""><cffile action="upload"
destination="myDirectory"
nameConflict="overwrite"
fileField="Form.pdfPath">
<cfset emailfile =
"myDirectory"&#cffile.ClientFileName#&"."&#cffile. ClientFileExt#></cfif>
<cfif form.image neq ""><cffile action="upload"
destination="myDirectory"
nameConflict="overwrite"
fileField="Form.image">
<cfset imagefile =
"myDirectory"&#cffile.ClientFileName#&"."&#cffile. ClientFileExt#></cfif>
<cfmail type="HTML"
to = "me@email.com"
from = "#getUser.email#"
subject = "#getUser.fname# #getUser.lname# has issued a request to
activate a news release." spoolenable="no">
<cfmailparam name = "Importance" value = "High">
<cfif form.pdfPath neq ""><cfmailparam file="#emailfile#"></cfif>
<cfif form.image neq ""><cfmailparam file = "#imageFile#"></cfif>
</cfmail>
<cffile action="Delete" file="#emailfile#">
<cffile action="Delete" file="#imagefile#">
brettcristofer Guest
-
CFFILE upload error - The process cannot access the filebecause it is being used by another process
I get this error intermitently when trying to upload a file. <cffile action='upload' ... To make sure there was nothing wrong with the file, i... -
#37998 [Asn->Fbk]: Parent process lost MySQLi connection after child process gone
ID: 37998 Updated by: tony2001@php.net Reported By: dbs at is dot ua -Status: Assigned +Status: ... -
Win32::Process, SetProcessAffinityMask for an existing process =perl crash
Hi! Was planning to use Win32::Process to set the ProcessAffinityMask of some processes but this lead to pure and simple crash of perl.exe. ... -
Win32::Process Kill Process in Windows ME
Hello, I want to kill a Process in Windows ME, which I have started. I have executed the following lines in XP and it works. I execute this in... -
Problem: Process.GetProcessesByName : Couldn't get process information from remote machine
As part of an ASP.NET application, I am creating an Excel spreadsheet using my .NET component. On my machine (win2K) I always get a... -
AnXiao #2
Re: CFFILE process
Place the # Signs Around form.PDFFile
like File="#Form.pdfFile#"
AnXiao Guest
-
brettcristofer #3
Re: CFFILE process
I get the following error when I do that:
The form field "C:\CFusionMX7\runtime\servers\coldfusion\SERV ER-INF\temp\wwwroot-tmp\neotmp34978.tmp" did not contain a file.
brettcristofer Guest
-
AnXiao #4
Re: CFFILE process
At Least we are getting a file path this time I don't use file uplads too often so I can't remember the specifics
sorry
AnXiao Guest
-
-
GGRam #6
Re: CFFILE process
I don't think you can skip a step like that. What you should do is have Form 2
save the uploaded file (as the upload actually occurred via step 1). Then if
step 2 results in upload haveing been accepted pass an accepted hidden variable
to Form3. Then Form 3 can perform DB operations, genernate the email and delete
the uploaded file, or merely delete the uploaded file.
GGRam Guest
-
brettcristofer #7
Re: CFFILE process
That sounds logical. I'll give it a go. Thanks.
brettcristofer Guest
-
Brian Hogue #8
Re: CFFILE process
CFfile can be fussy. The upload filename needs to come from the form
variable, where the form has that EncType syntax. I found it easier to ask
for the file on one page (your step 1) and upload the file on the next page
(your step 3). Adding other code between those steps never worked for me.
Doing it this way has always worked for me. If you make it work another way,
please post.
-brian
"brettcristofer" <webforumsuser@macromedia.com> wrote in message
news:d8sdt2$rmq$1@forums.macromedia.com...process> I'm having some difficulty using CFFILE. Basically I have a three stepFiles> that does the following:
>
> Form 1. Fill in form and select image and pdf file for server upload.<cfparam>> are uploaded to server so they can be atached to an e-mail using thestep).> tag and then are deleted from server after attached (all in the lastor> Form 2. Preview the form contents as it will appear on web. Either Acceptare not> Edit form.
> Form 3. If Accepted, perform DB operations and file upload/deletion.
>
> I want to do the server upload in the final step but my selected filesAn> passing to the 3rd step. I get an error that says "The form field
> "Form.pdfPath" did not contain a file. " Not too familiar with <CFFILE>.first> anyone tell me what I'm doing wrong? I've included my code.
>
> I get the upload to work if I go directly to cffile="upload" from the> form but adding another step in the middle seems to lose the file.
>
> Thanks for any help.
>
> Form 1:
> <form name="form" method="POST" action="form2.cfm"
> enctype="multipart/form-data">
> <input type="file" name="pdfPath" size="25" maxlength="100">
> <input type="file" name="image" size="25" maxlength="100">
> </form
>
> Form 2:
> <form name="form" method="POST" action="form3.cfm"
> enctype="multipart/form-data">
> <cfoutput>
> <input type="hidden" name="pdfPath" id="pdfPath" value="#pdfPath#">
> <input type="hidden" name="image" id="image" value="#image#">
> </cfoutput>
> </form>
>
> Form 3:
> <!---Mail Activation Request and File Attachments to Site Administrator
> <cfif form.pdfPath neq ""><cffile action="upload"
> destination="myDirectory"
> nameConflict="overwrite"
> fileField="Form.pdfPath">
> <cfset emailfile =
> "myDirectory"&#cffile.ClientFileName#&"."&#cffile. ClientFileExt#></cfif>
>
> <cfif form.image neq ""><cffile action="upload"
> destination="myDirectory"
> nameConflict="overwrite"
> fileField="Form.image">
> <cfset imagefile =
> "myDirectory"&#cffile.ClientFileName#&"."&#cffile. ClientFileExt#></cfif>
> <cfmail type="HTML"
> to = "me@email.com"
> from = "#getUser.email#"
> subject = "#getUser.fname# #getUser.lname# has issued a request to
> activate a news release." spoolenable="no">
> <cfmailparam name = "Importance" value = "High">
> <cfif form.pdfPath neq ""><cfmailparam file="#emailfile#"></cfif>
> <cfif form.image neq ""><cfmailparam file = "#imageFile#"></cfif>
> </cfmail>
> <cffile action="Delete" file="#emailfile#">
> <cffile action="Delete" file="#imagefile#">
>
Brian Hogue Guest



Reply With Quote

