Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default 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

  2. Similar Questions and Discussions

    1. 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...
    2. #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: ...
    3. 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. ...
    4. 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...
    5. 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...
  3. #2

    Default Re: CFFILE process

    Place the # Signs Around form.PDFFile
    like File="#Form.pdfFile#"
    AnXiao Guest

  4. #3

    Default 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

  5. #4

    Default 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

  6. #5

    Default Re: CFFILE process

    Thanks for the help.
    brettcristofer Guest

  7. #6

    Default 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

  8. #7

    Default Re: CFFILE process

    That sounds logical. I'll give it a go. Thanks.
    brettcristofer Guest

  9. #8

    Default 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...
    > 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#">
    >

    Brian Hogue Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139