Cffile action = "upload"

This question was posted in response to the following article: http://help.adobe.com/en_US/ColdFusion/10.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7 38f.html

Wow, I just noticed that this page makes no mention of the new STRICT attribute added in CF10 for CFFILE action="upload". I also checked and find no reference to it in the Developing CF Apps manual. There's a brief mention of it in the main page for CFFILE here in the CFML Reference, but it doesn't explain what the feature does. It seems (for now) that the best resource may be the blog entry from Sagar Ganatra, who was an Adobe engineer: http://www.sagarganatra.com/2012/03/coldfusion-10-cffile-restricting-file.html

Similar Messages

  • CFfile multiple upload problem

    Hello~
    I am using two cfinput tags with a type of "file" within the same form. They accept different file types, using regex validation to check each, and have different name and id values.
    <!--- FORM FIELDS ---><cfinput type="file" name="pageLayoutCSSFileUpload" class="inputArea" message="Please upload a .css file." required="yes" size="50" id="pageLayoutCSSFileUpload" validate="regex" pattern="^.*\.(css|CSS)$" /><cfinput type="file" name="pageLayoutImageUpload" class="inputArea" message="Please upload a layout image (.gif)." required="yes" size="50" id="pageLayoutImageUpload" validate="regex" pattern="^.*\.(gif|GIF)$" />
    Once the form is submitted, I am using cffile to upload each to the same directory, with the same name, but different extensions (one .css and one .gif). The first file, .css, uploads correctly. Then I get an error with the second cffile tag that the mime-type is incorrect, and that the file must be in the image/gif format. I know that the test files I am using are in the correct format, so it seems like the second cffile tag is looking at the first file that is being uploaded. I don't know how this can happen, as the "file" value for each cffile tag is being set through a form variable, which relates directly to the two seperate input fields.
    <!--- FORM ACTION ---><!--- upload page layout CSS file --->
    <cffile action="upload" destination="#local.pageLayoutsPath#pageLayout_#numberFormat(local.layoutID,000)#" file="#form.pageLayoutCSSFileUpload#" nameconflict="error" result="local.pageLayoutCSSFileUpload" accept="text/css" />
    <!--- upload page layout image file (large) --->
    <cffile action="upload" destination="#local.pageLayoutsPath#pageLayout_#numberFormat(local.layoutID,000)#" file="#form.pageLayoutImageUpload#" nameconflict="error" result="local.pageLayoutImageUpload" accept="image/gif" />
    Has anyone else had this problem? It is complicated to explain, so let me know if this doesn't make sense... Thanks!

    According to the docs (and my past experience):
    http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-73 8f.html
    <cffile action="upload"> requires a FILEFIELD attribute, which should be the name of the form field relevant to the file in question.  Note: not the VALUE of the form field, but the NAME of it.
    I'm surprised your code isn't erroring, given FILEFIELD is - appaerently - required.
    Adam

  • Confused about cffileupload & cffile action="uploadall"

    I'm trying to figure out how to use cffileupload so I have a braindead .cfm file:
    <cffileupload 
        url="uploadFiles.cfm"
        progressbar="true"
        name="myupload"
        addButtonLabel = "Add File"
        clearButtonlabel = "Clear All"
        width=600
        height=400
        title = "File Upload"
        maxuploadsize="30"
        extensionfilter="*.jpg, *.png, *.flv, *.txt"
        BGCOLOR="##FFFFFF"
        MAXFILESELECT=10
        UPLOADBUTTONLABEL="Upload now"/>
    which is the one from the documentation page. Where I'm losing it is in the processing file.
    If the file contains only:
    <cffile action="uploadall" destination="c:/testload" nameConflict="overwrite">
    the files upload and no problems. The issue is that I want to do additional processing on
    each file after it arrives. I've tried this:
    <cfoutput>
    <cffile action="uploadall" destination="c:/testload" nameConflict="overwrite">
    <cfimage source="C:/testload/#CFFile.serverfile#" action="resize" width="300" height="" destination="c:/testload/small.jpg" overwrite="yes">
    </cfoutput>
    and the CFFILEUPLOAD status bar shows an HTTP 500 error.
    Is the uploadFiles.cfm called for each file individually, i.e., if I upload
    3 files, is it invoked three times? If so, how do I access the server side file name? If I use
    CFFILE.serverFile, I get a HTTP 500 error. Or is this an array or CFFILE structures? I've
    tried multiple different approaches and all I get is the HTTP 500 error. None of the examples
    I can find explain this or show readable code. Thanks.

    Of all the CF tags I've used, this one is the biggest pain
    because when it thows an error, there is very little information
    to help you track it down. All that happens is the progress bar
    turn red and (in my experience) shows a 500 error. Not terribly
    illuminating. The way I was finally able to debug it was to start
    at the absolute minimum. The example on the web:
    http://www.remotesynthesis.com/post.cfm/multi-file-uploads-with-coldfusion-9
    -in-5-lines
    is the absolute minimum. I put this into two files, one with the
    CFFILEUPLOAD code and the other with the CFFILE UPLOADALL code.
    Once I had that working on my testing server, I then began to add
    other real code. Again, the challenge is that if you make so much
    as one typo (leaving off a # is my bane) in the CFFILE UPLOADALL file, you
    get the same red
    process bar with a 500 error. So, in the braindead exploration code,
    I hard coded the destination, etc., etc., and then started adding to
    it.
    BTW, another thing that I discovered that may be tripping you up is if
    you're
    trying to pass parameters on the URL paramter of the CFFILEUPLOAD. You might
    want to look at this:
    http://www.coldfusioning.com/index.cfm/2009/8/24/cffileupload-Passing-Multip
    le-URL-Parameters
    Hope this helps! As I said, this tag was a real bear to use but once
    you wade through all the black holes, it's pretty neat.
    Steve Haeffele
    130 Riviera Dunes Way #1001
    Palmetto, FL 34221
    Tel: 941-531-7227
    Cell: 408-394-3831
    Fax: 941-866-2628
    e-mail: [email protected]

  • Using CFFILE To Upload a Full Directory

    I am attempting to build a process to load multiple files
    from a directory. It is easy enough to use looping processes with
    multiple <input type="file".... tags (or even a single tag
    looped over multiple times) in both the form and the action page.
    However, I want to use a single action to load all files in a
    specified directory on the client desktop to the server. Is there a
    standard process or does anyone know a CFC or CFX tag? Note, this
    will be used with both MX7 and CF 5 servers.
    Thanks,

    klltkd wrote:
    > I am attempting to build a process to load multiple
    files from a directory. It
    > is easy enough to use looping processes with multiple
    <input type="file"....
    > tags (or even a single tag looped over multiple times)
    in both the form and the
    > action page.
    >
    > However, I want to use a single action to load all files
    in a specified
    > directory on the client desktop to the server. Is there
    a standard process or
    > does anyone know a CFC or CFX tag? Note, this will be
    used with both MX7 and CF
    > 5 servers.
    >
    > Thanks,
    >
    Unless you are working within a well defined network where
    ColdFusion
    can access the client machine by UNC path, then ColdFusion is
    not
    involved in this. You are looking for a client solution that
    will
    create the upload. After that it looks the same to
    ColdFusion.
    I am not personally aware of any client tools like you
    describe. There
    are security concerns when one makes it too convienant to
    programatically select what is uploaded to a remote computer.

  • Custom Actions upload error in 12.2

    Hello!
    I have error while uploading custom action in MII 12.2:
    [005056A30000244C0000000D00001398] File could not be loaded. com.sap.xmii.temp.upload.17164.jar. Check error log for details.
    There are 3 error and warning types in Log Viewer:
    1) Could Not Find Assembly File GaCustoms.jar
    2) MISSING_ASSEMBLY_FILE
    3) *** MISSING RESOURCE: Unable to localize MISSING_ASSEMBLY_FILE

    It works normaly with MII 12.1.8.
    I've got new blssdk.zip from 12.2 and just recreated .jar file.
    <?xml version="1.0" encoding="utf-8" ?>
    <ComponentCatalog>
         <Category Name="GaCustoms" Description="GaCustoms">
              <Component Type="Action"
                   Name="DosEncodingSaver"
                   Description=""
                   Label="DosEncodingSaver"
                   ClassName="DosEncodingSaver.DosEncodingSaver"
                   AssemblyName="GaCustoms.jar"
                   HelpFileName="" />
              <Component Type="Action"
                   Name="Base64Saver"
                   Description=""
                   Label="Base64Saver"
                   ClassName="Base64Saver.Base64Saver"
                   AssemblyName="GaCustoms.jar"
                   HelpFileName="" />
         </Category>
    </ComponentCatalog>
    Edited by: A.Andreev on Nov 11, 2011 10:55 AM

  • How do I use CFTHREAD in combination with CFFILE Upload

    I've been reading how CFTHREAD is supposed to release the
    client so that long-lasting operations like a CFFILE upload can
    continue to do their business while the client does something else.
    How does this work exactly? I can't find any concrete
    references. For example, I have a regular file upload form. A user
    uploads a large file, say 100Mb, and I want to use CFTHREAD (or
    something) to handle the upload process, which I know may take
    hours depending on the connection, and immediately return the page
    for the client saying "Your file is being processed. Please check
    back later."
    I tried wrapping some CFFILE code with CFTHREAD, but when I
    ran it the page just sat there working while the file was being
    uploaded, so I did not witness any change whatsoever in how its
    being handled. What am I missing?
    <cfthread action="run" name="uploadVideo">
    <cffile
    action="upload"
    destination = "/var/www/video1/assetsIN"
    nameconflict="overwrite"
    filefield="video" />
    </cfthread>
    Thanks for any help.
    UPDATE: I asked Ben Forta this in an email yesterday and here
    was his response:
    What you are doing is correct. The actual file processing
    (getting the uploaded file) will not happen in a separate thread.
    Were you expecting a separate thread for the upload itself? CF
    can’t do that for you s CF does not have the file until it is
    uploaded. Actually, CF is not even called until the form is
    submitted (which includes the file being uploaded). It sounds like
    you want the browser to do an upload in the background. This may be
    doable using JavaScript and Ajax type controls. Or maybe using
    browser tabs or something. -Ben

    With file uploads the time consumption is between the client
    PC and the web
    server, not the web server and the CF server (which are
    usually on the same
    machine). All <cffile action="upload"> does is copy the
    uploaded file from
    the web server's temp upload dir to [wherever you tell it to
    go]: it's a
    local process, and should be fairly quick; certainly compared
    to the
    process of getting it to the web server in the first place.
    Even if the data transmission was between the client PC and
    the CF server,
    you can't expect <cfthread> to somehow increase the
    bandwitdh and speed up
    the file upload between the two machines.
    <cfthread> could come into its own if you had some file
    processing to
    perform on the file *after* it's uploaded: unzipping it,
    doing some image
    manipulation, parsing a CSV file into a DB, that sort of
    thing. Not for
    the initial upload.
    Adam

  • Multiple cffile upload issues

    Hello all. I'm having a little issue with a multiple upload I
    am trying to achieve. I've been searching and searching but could
    not find an answer, and maybe you guys could help me. Well I'm
    doing multiple uploads on a form i created and it's uploading the
    file and file name correctly, but it's inserting 6 records
    everytime I'm hitting the submit button. Also, I've notice in my
    database is when you click the submit button, it's inserting the
    same file in one record 6 times, then it creates a new record and
    inserts the second file 6 times. I'm going to post the code here,
    maybe it's something I'm missing, not sure. Thanks for the help.

    dame.cranon wrote:
    > Hello all. I'm having a little issue with a multiple
    upload I am trying to
    > achieve. I've been searching and searching but could not
    find an answer, and
    > maybe you guys could help me. Well I'm doing multiple
    uploads on a form i
    > created and it's uploading the file and file name
    correctly, but it's inserting
    > 6 records everytime I'm hitting the submit button. Also,
    I've notice in my
    > database is when you click the submit button, it's
    inserting the same file in
    > one record 6 times, then it creates a new record and
    inserts the second file 6
    > times. I'm going to post the code here, maybe it's
    something I'm missing, not
    > sure. Thanks for the help.
    >
    >
    >
    > <cfloop index="i" from="1" to="6">
    >
    > <cfif isDefined("form.upload")>
    >
    > <cffile action="upload"
    > destination="D:\Hosting\streetzmag\dev\crush_images\"
    > filefield="pic#i#"
    > nameconflict="makeunique"
    > result="cffile.pic#i#"
    > accept="image/jpeg, image/pjpeg, image/gif" >
    >
    > <!--- Code for insert of information --->
    > <cfquery datasource="mysqlcf_streetzmag"
    name="uploaded">
    > INSERT INTO Information(firstname,
    > lastname,
    > email,
    > contact_info,
    > nickname,
    > recent_work,
    > hair_color,
    > eye_color,
    > ethnicity,
    > age,
    > height,
    > measurements,
    > pic_1,
    > pic_2,
    > pic_3,
    > pic_4,
    > pic_5,
    > pic_6
    >
    >
    > )
    > VALUES('#FORM.firstname#',
    > '#FORM.lastname#',
    > '#FORM.email#',
    > '#FORM.contact#',
    > '#FORM.nickname#',
    > '#FORM.work#',
    > '#FORM.hair#',
    > '#FORM.eye#',
    > '#FORM.ethnic#',
    > #FORM.age#,
    > '#FORM.height#',
    > '#FORM.measurements#',
    > <cfif isDefined("form.pic#i#") and
    evaluate("form.pic#i#") NEQ "">
    > <cfqueryparam
    value="#CFFILE['pic'&i].SERVERFILE#" cfsqltype="cf_sql_varchar"
    > />
    > <cfelse>
    > NULL
    > </cfif>,
    >
    > <cfif isDefined("form.pic#i#") and
    evaluate("form.pic#i#") NEQ "">
    > <cfqueryparam
    value="#CFFILE['pic'&i].SERVERFILE#" cfsqltype="cf_sql_varchar"
    > />
    > <cfelse>
    > NULL
    > </cfif>,
    >
    > <cfif isDefined("form.pic#i#") and
    evaluate("form.pic#i#") NEQ "">
    > <cfqueryparam
    value="#CFFILE['pic'&i].SERVERFILE#" cfsqltype="cf_sql_varchar"
    > />
    > <cfelse>
    > NULL
    > </cfif>,
    >
    > <cfif isDefined("form.pic#i#") and
    evaluate("form.pic#i#") NEQ "">
    > <cfqueryparam
    value="#CFFILE['pic'&i].SERVERFILE#" cfsqltype="cf_sql_varchar"
    > />
    > <cfelse>
    > NULL
    > </cfif>,
    >
    > <cfif isDefined("form.pic#i#") and
    evaluate("form.pic#i#") NEQ "">
    > <cfqueryparam
    value="#CFFILE['pic'&i].SERVERFILE#" cfsqltype="cf_sql_varchar"
    > />
    > <cfelse>
    > NULL
    > </cfif>,
    >
    > <cfif isDefined("form.pic#i#") and
    evaluate("form.pic#i#") NEQ "">
    > <cfqueryparam
    value="#CFFILE['pic'&i].SERVERFILE#" cfsqltype="cf_sql_varchar"
    > />
    > <cfelse>
    > NULL
    > </cfif>
    >
    > )
    > </cfquery>
    > </cfif>
    > </cfloop>
    >
    of course it will do everything 6 times since you have your
    whole code
    wrapped with cfloop from 1 to 6... so the code execution will
    happen 6
    times... plus your synatx for inserting filenames inside your
    query
    makes it insert same file 6 times (since the code is inside
    one same
    cfloop)...
    you should separate your code and wrap only the cffile part
    in a cfloop:
    <cfif isDefined("form.upload")>
    <cfloop index="i" from="1" to="6">
    <cfif len(trim(form.pic#i#)) gt 0>
    <cffile action="upload"
    destination="D:\Hosting\streetzmag\dev\crush_images\"
    filefield="pic#i#"
    nameconflict="makeunique"
    result="uploadedpic_#i#"
    accept="image/jpeg, image/pjpeg, image/gif" >
    </cfif>
    </cfloop>
    <!--- Code for insert of information --->
    <cfquery datasource="mysqlcf_streetzmag"
    name="uploaded">
    INSERT INTO Information
    (firstname,
    lastname,
    email,
    contact_info,
    nickname,
    recent_work,
    hair_color,
    eye_color,
    ethnicity,
    age,
    height,
    measurements,
    pic_1,
    pic_2,
    pic_3,
    pic_4,
    pic_5,
    pic_6)
    VALUES('#FORM.firstname#',
    '#FORM.lastname#',
    '#FORM.email#',
    '#FORM.contact#',
    '#FORM.nickname#',
    '#FORM.work#',
    '#FORM.hair#',
    '#FORM.eye#',
    '#FORM.ethnic#',
    #FORM.age#,
    '#FORM.height#',
    '#FORM.measurements#',
    <cfloop from="1" to="6" index="x">
    <cfif isdefined("uploadedpic_#x#")>
    <cfqueryparam value="#evaluate('uploadedpic_' & x)#"
    cfsqltype="cf_sql_varchar"/>
    <cfelse>
    NULL
    </cfif>
    <cfif x lt 6>,</cfif>
    </cfloop>)
    </cfquery>
    </cfif>
    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com

  • Cffunction adn cffile upload

    Hello to everyone !
    I have a problem to upload a file with cffunction :
    i created a cfc with a function 'upload' :
    <cffunction name="upload" access="remote"
    returntype="void">
    <cfargument name="image_big" type="any" required="no">
    <cffile action="upload" fileField="#arguments.image_big#"
    destination = "mylocation" nameConflict="overwrite"
    accept="image/*">
    </cffunction>
    but it doesn’t work with out submitting the form ..
    pleas help ..
    thanks !

    I believe you need to have the file submitted via a form if
    you want to use the <cffile action="upload" fileField="">
    method of cffile. Otherwise, how will the server gain access to the
    file itself?

  • Need Help on cffile upload, destination to another server

    Anyone know why get this error? The specified directory attribute value Z:\Project_X\UploadFile\DlrPayInq\ could not be created.
    The setup of my server is as below : -
    I'm trying to use cffile to upload a file where by the destination i declare is located at another server which is my file server.
    i had create a mapping from my application server to the file server as Z:.
    <cfset dlrPayInq_w = "Z:\Project_X\UploadFile\DlrPayInq\">
    <cfif trim(fileName) NEQ "">
         <cfif directoryexists(dlrPayInq_w)>
    <cfelse>
        <!--- Create this folder --->
        <cfdirectory action = "create"
        directory = "#dlrPayInq_w#">
    </cfif>
    <cffile action="UPLOAD" filefield="fileName" destination="#dlrPayInq_w#" nameconflict="overwrite">
    I had grant the folder permision to User type USER with Full Control, i can login as a normal window user and create files at  Z:\Project_X\UploadFile\DlrPayInq\ manually.
    But when i try to upload file using cffile in my program, i hit this error The specified directory attribute value Z:\Project_X\UploadFile\DlrPayInq\ could not be created. Actually the folder DlrPayInq is already exist in that fileserver, how come CF trying to create again?
    I try to remove this code
    <cfif trim(fileName) NEQ "">
         <cfif directoryexists(dlrPayInq_w)>
    <cfelse>
        <!--- Create this folder --->
        <cfdirectory action = "create"
        directory = "#dlrPayInq_w#">
    </cfif>
    and i get another error, CFFILE atttribute error.
    Any expert can help? Thanks for advanced.

    To expand on tclaremont's reply.  "Z:" that you are using is a mapped drive and mapped drives are user specific.  So as well as making sure that ColdFusion is running as a user that has permissions to the remote server, you would have to log into the server using ColdFusions user account and create the mapped drive under that user.
    Most people don't bother with mapped drivers but rather use UNC path syntax.  Which would looks something like "\\MyRemoteServersName\Project_X\UploadFile\DirPayInq\"

  • How To Access Uploaded File Data Prior To CFFILE

    Hi:
    Can anyone say why #GetHttpRequestData().content# is empty when I upload files using the conventional input type="file" and form method="post" enctype="multipart/form-data" HTML?
    My goal is to inspect the binary data before using cffile action="upload". Is there a way to do this through CF or perhaps Java? Thanks.

    Supposing the form field is <input type="file" name="myUpload">, then you could simply intercept the uploaded binary like this:
    <!--- We are in the upload form's action page --->
    <cffile action="read" file="#form.myUpload#" variable="binaryData">
    <!--- Dump the binary data --->
    <cfdump var="#binaryData#">
    <cffile action = "upload"
        fileField = "myUpload"
        destination = ... etc.>

  • Time cffile upload

    Hi everyone,
    I want to time the upload time when using CFFILE
    I thought I could take the tome before the cffile tag and then take the time after the cffile tg and use the Datediff to get the upload time in seconds. See example below.  But this gives me 0 seconds.
    ------------- Example ------------
    <cfset startTime = Now()>
    <cffile action="upload" destination="#application.upload_images#"  filefield="#variables.filename#" nameconflict="MakeUnique" accept="image/jpg,image/jpeg,image/pjpeg">
    <cfset endTime = Now()>
    <cfset uploadTime = DateDiff("s", startTime, endTime)>
    How can I time the upload time?
    Thanks!

    The CFFILE tag that processes the upload doesn't actually have anything to do with receiving the file. By the time CF runs, the request has already been received in full by the web server.
    So, you need to do your timing from the client in this case, not the web server. There are plenty of timing tools for Firefox and presumably Chrome as well. Load test tools do client-side timing as well.
    Dave Watts, CTO, Fig Leaf Software
    http://www.figleaf.com/
    http://training.figleaf.com/

  • Is there a way to silently upload files?

    Ok, so I've taken the plunge. I've started working on an AIR
    app using Flash CS3. I'm putting together a little app that will
    keep my online store updated with all the product updates from our
    wholesaler. This includes parsing a csv file, downloading product
    images from the wholesaler, updating the database, and then
    uploading the images to our server.
    The problem is that AIR does not seem to have the
    functionality to silently upload files! Sure, I can use the
    file.reference object to fire off the browse method, which then
    opens the OS file browser window BUT I would really like the whole
    thing to be hands off. In the past, I've written these types of
    apps using Visual Studio but I haven't touched VS in two years.
    Has anyone run across a way to silently upload or ftp files
    in AIR?

    Hey Oliver,
    Thanks for your answer--the fact that it CAN be done has
    gotten me a lot further on finding a solution. Here's what I have
    so far. As it runs, I can see the progress and completion of the
    upload but I'm still not getting it saved. I'm uploading it to a
    ColdFusion processing page.
    AS3 Code:
    import flash.filesystem.*;
    import flash.net.URLRequest;
    //Silent File Upload (no browse window)
    function imageUpload(imageName,uploadPage):void
    trace('Starting Upload of ' + imageName + '\n');
    var myFile:File =
    File.applicationDirectory.resolvePath(imageName);
    var request:URLRequest = new URLRequest(uploadPage);
    request.method = URLRequestMethod.POST;
    myFile.addEventListener(ProgressEvent.PROGRESS,progressHandler);
    myFile.addEventListener(Event.COMPLETE,completeHandler);
    myFile.upload(request,"theFile");
    function progressHandler(event:ProgressEvent):void {
    var file:FileReference = FileReference(event.target);
    var pLoaded =
    Math.ceil(event.bytesLoaded/event.bytesTotal*100);
    trace(pLoaded + '% uploaded');
    function completeHandler(event:Event):void
    trace ('Upload complete.');
    var uploadPage = "
    http://www.aaronbday.com/upload_file.cfm";
    imageUpload("angelic_cat.jpg",uploadPage);
    Here's the CFM page:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN" "
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="
    http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=utf-8" />
    <title>Upload File</title>
    </head>
    <body>
    <cfif isDefined("form.theFile")>
    <!---we only want images--->
    <cffile
    action="upload"
    destination="#ExpandPath("test/")#"
    filefield="theFile"
    nameconflict="overwrite"
    accept="image/jpg,image/jpeg,image/gif,image/pjpeg"
    >
    <cfoutput><img src="test/#cffile.serverFile#"
    /></cfoutput>
    <cfelse>
    <form method="post" action="upload_file.cfm"
    enctype="multipart/form-data">
    <input type="file" name="theFile" />
    <input type="submit" name="Submit" />
    </form>
    </cfif>
    </body>
    </html>
    Any ideas? Thanks!

  • How can I upload an .jpg file to server from browser?

    Hi!
    I am trying to create a webpage whereby myself or any one of my managers can easily create an e-mail & send to our client database. I would like to be able to upload an image to be included with the email, which I have been trying to do using <cffile>, but I get an error message:
    Security: The requested template has been denied access to http:\***MY WEB ADDRESS****.
    I'm assuming that this is an issue with my hosting server, but I fail to see a way round it as I cannot add ftp login data to a <cffile> tag.
    I have also tried to do the same thing with <cfftp> tag including the ftp login data, but this returns an error whereby the website cannot access the file from my hard drive.
    Does anyone have a solution?

    What does your code look like? Something like this?
    <cfif isDefined("form.image") >
        <cffile action = "upload"
            fileField = "image"
            destination = "c:\uploads\images"
            accept = "image/jpg,image/pjpeg,image/jpeg"
            nameConflict = "MakeUnique">
            Done uploading image!
    <!--- Put the code to send email here including, for example, c:\uploads\images\#cffile.serverfile# as attachment --->
    <cfelse>
        <cfform method="post" action="#cgi.script_name#"
            name="uploadForm" enctype="multipart/form-data">
            <cfinput name="image" type="file">
            <br><br>
            <cfinput name="submit" type="submit" value="Upload image">
        </cfform>
    </cfif>

  • Uploading a file, renaming it and placing it in a particular location on server

    A user submits a file from a front end HTML form which has fields like Division, Department name, department number,
    section number, year, email, phone etc. The file being submitted might have a user given name. But, when it is 
    uploaded I want it to be named as Departmentname_departmentnumber_sectionnumber. So, if department is Accounting, 
    dept number is 123 and section is 1, name of file will be Accounting_123_1.doc The extension will be whatever type 
    of file(text, MS-Word's .doc or .docx, PDF or RTF) was submitted and the user can upload attachments of files with 
    extension .txt, .doc, .docx, pdf, rtf only.
    Also, I want it to be stored on a particular location on server. So, if Division is Corporate Finance and year is 
    2011-2012 it should be stored on server at "E:\Files Submitted\2011-2012\Corporate Finance\". The "E:\Files
    Submitted\" part remains same in the directory name.
    <cfset submittedfileName =
    #form.departmentname#&"_"&#form.departmentnumber#&"_"&#form.section_number_1#&"."&#cffile. ClientFileExt#>
    <cfset filedirectoryYear = "E:\Files Submitted\"&#form.current_year#&"\"&#form.division#&"\">
    <!--- ensure that the user uploads attachments of type with extension .txt, .doc, .docx, pdf, rtf only--->
    <cfif FORM.attachment_1 neq "">
           <cffile action="upload"
                   accept="text/plain,application/msword,application/pdf,application/rtf"          
                     filefield="attachment_1"
                     destination="E:\temp\uploads"
                     nameconflict="Makeunique"
            >
    <!--- rename the file and move it to permanent destination --->        
            <cffile
      action="rename"
      source="E:\temp\uploads\#cffile.serverFileName#"
      destination=#filedirectoryYear#&#submittedfileName#&#cffile.ClientFileExt#
      >
    <!---   now create a temporary variable for the attachment so that it can be emailed later on --->
    <cfset attachment_local_file_1 = #filedirectoryYear#&#submittedfileName#&#cffile.ClientFileExt#>
    </cfif>
    I used the cffile.ClientFileExt because the files were getting uploaded without the extension but am receiving an
    error at   destination=#filedirectoryYear#&#submittedfileName#&#cffile.ClientFileExt# as "multiple items at this
    position: Missing Token > or /> .
    I am using Coldfusion 8. Any suggestions would be appreciated on where I am erring and how I can fix it.

    Thanks Dan,
    The space between 'l' and 'e' was a formatting error while I was pasting text to this forum.
    Currently, I have
    <cfset filedirectoryYear = "E:\Files Submitted\"&#form.current_year#&"\"&#form.division#&"\">
    <cfif FORM.attachment_1 neq "">
           <cffile action="upload"
                   accept="text/plain,application/msword,application/pdf,application/rtf "          
                     filefield="attachment_1"
                     destination="E:\temp\uploads"
                     nameconflict="Makeunique"
            >
    <!--- rename the file and move it to permanent destination --->        
    <cfset submittedfileName =
    #form.departmentname#&"_"&#form.departmentnumber#&"_"&#form.section_number_1#&"."&#cffile. ClientFileExt#>
    <cfset presentfileName = #cffile.serverFileName#&"."&#cffile.ClientFileExt#>
            <cffile
      action="rename"
      source="E:\temp\uploads\#presentfileName#"
      destination=#filedirectoryYear##submittedfileName#
      >
    <!---   now create a temporary variable for the attachment so that it can be emailed later on --->
    <cfset attachment_local_file_1 = #filedirectoryYear#&#submittedfileName#&#cffile.ClientFileExt#>
    </cfif>
    <cfset attachment_local_file_1 = #filedirectoryYear#&#submittedfileName#>
    When I submit, I get the error message
    "Attribute validation error for tag CFFILE.
    The value of the attribute source, which is currently c:\Course Syllabi\uploads\Web Based System Two Page HandOut.pdf, is invalid and the line below is referred.
    destination="#filedirectoryYear##submittedfileName#"
    The filedirectoryYear path exists i.e. I have E:\Files Submitted\2011-2012\Finance. What could be the issue?
    P.S. I got it working, The filedirectoryYear path value was not the actual directory path\name in the filesystem. Once I had the
    correct name in the filesystem, the application worked fine.

  • Problem with Multi File upload example, help needed

    I got the code from the following location.....
    http://www.adobe.com/devnet/coldfusion/articles/multifile_upload.html
    And I've got it to work to some degree except I cant get the file transfer to work when pressing, Upload.   Below is what my debugger outputs.  Any thoughts on how to fix this or even what it means?
    At the very bottom of this message is the upload.cfm code.......
    Thanks in advance for the help
    <html>
    <head>
      <title>Products - Error</title>
    </head>
    <body>
    <h2>Sorry</h2>
    <p>An error occurred when you requested this page.
    Please email the Webmaster to report this error.
    We will work to correct the problem and apologize
    for the inconvenience.</p>
    <table border=1>
    <tr><td><b>Error Information</b> <br>
      Date and time: 12/07/09 22:25:51 <br>
      Page:  <br>
      Remote Address: 67.170.79.241 <br>
      HTTP Referer: <br>
      Details: ColdFusion cannot determine how to process the tag &lt;CFDOCUMENT&gt;. The tag name may be misspelled.<p>If you are using tags whose names begin with CF but are not ColdFusion tags you should contact Allaire Support. <p>The error occurred while processing an element with a general identifier of (CFDOCUMENT), occupying document position (41:4) to (41:70).<p>The specific sequence of files included or processed is:<code><br><strong>D:\hshome\edejham7\edeweb.com\MultiFileUpload\upload.cfm      </strong></code><br>
      <br>
    </td></tr></table>
    </body>
    </html>
    <!---
    Flex Multi-File Upload Server Side File Handler
    This file is where the upload action from the Flex Multi-File Upload UI points.
    This is the handler the server side half of the upload process.
    --->
    <cftry>
    <!---
    Because flash uploads all files with a binary mime type ("application/ocet-stream") we cannot set cffile to accept specfic mime types.
    The workaround is to check the file type after it arrives on the server and if it is non desireable delete it.
    --->
        <cffile action="upload"
                filefield="filedata"
                destination="#ExpandPath('\')#MultiFileUpload\uploadedfiles\"
                nameconflict="makeunique"
                accept="application/octet-stream"/>
            <!--- Begin checking the file extension of uploaded files --->
            <cfset acceptedFileExtensions = "jpg,jpeg,gif,png,pdf,flv,txt,doc,rtf"/>
            <cfset filecheck = listFindNoCase(acceptedFileExtensions,File.ServerFileExt)/>
    <!---
    If the variable filecheck equals false delete the uploaded file immediatley as it does not match the desired file types
    --->
            <cfif filecheck eq false>
                <cffile action="delete" file="#ExpandPath('\')#MultiFileUpload\uploadedfiles\#File.ServerFile#"/>
            </cfif>
    <!---
    Should any error occur output a pdf with all the details.
    It is difficult to debug an error from this file because no debug information is
    diplayed on page as its called from within the Flash UI.  If your files are not uploading check
    to see if an errordebug.pdf has been generated.
    --->
            <cfcatch type="any">
                <cfdocument format="PDF" overwrite="yes" filename="errordebug.pdf">
                    <cfdump var="#cfcatch#"/>
                </cfdocument>
            </cfcatch>
    </cftry>

    Just 2 things in my test:
    1) I use no accept attribute. Coldfusion is then free to upload any extenstion.
    Restricting the type to application/octet-stream may generate errors. Also, it is unnecessary, because we perform a type check anyway.
    2) I have used #ExpandPath('.')#\ in place of #ExpandPath('\')#
    <cfif isdefined("form.filedata")>
    <cftry>
    <cffile action="upload"
                filefield="filedata"
                destination="#expandPath('.')#\MultiFileUpload\uploadedfiles\"
                nameconflict="makeunique">
            <!--- Begin checking the file extension of uploaded files --->
            <cfset acceptedFileExtensions = "jpg,jpeg,gif,png,pdf,flv,txt,doc,rtf"/>
            <cfset filecheck = listFindNoCase(acceptedFileExtensions,File.ServerFileExt)/>
    <!---
    If the variable filecheck equals false delete the uploaded file immediatley as it does not match the desired file types
    --->
            <cfif filecheck eq false>
                <cffile action="delete" file="#ExpandPath('.')#\MultiFileUpload\uploadedfiles\#File.ServerFile#"/>
                <cfoutput>Uploaded file deleted -- unacceptable extension (#ucase(File.ServerFileExt)#)</cfoutput>.<br>
            </cfif>
    Upload process done!
            <cfcatch type="any">
                There was an error!
                <cfdocument format="PDF" overwrite="yes" filename="errordebug.pdf">
                    <cfdump var="#cfcatch#"/>
                </cfdocument>
            </cfcatch>
    </cftry>
    <cfelse>
    <form method="post" action=<cfoutput>#cgi.script_name#</cfoutput>
            name="uploadForm" enctype="multipart/form-data">
            <input name="filedata" type="file">
            <br>
            <input name="submit" type="submit" value="Upload File">
        </form>
    </cfif>

Maybe you are looking for

  • Cannot bring up 'reply' when attempting to reply to email

    I received an email and wished to reply to it, but the option to 'reply' did not appear.

  • Disable the STOP/PLAY tap on a video

    How i can disabling the STOP/PLAY tap on a video (so it can start as the cover of the Folio) and without having the user to unexpectedly stop it. Even if the video is full screen.

  • Blocked Order Value Increase Credit Exposure

    There is a requirement form the company that Blocked Sales Order should also be added to credit exposure. Are you aware of any companies using such process? Is it possible from technical point of view? Is it require whole SD redesign? Thanks for your

  • Installing SAP 4.6B with existing database

    Good evenning. I need to install SAP 4.6B with existing database in SQL Server 2003. How can I do this installation?. Can you send me many guide? Best regards. Luis Gomez.

  • My installed programs in CC updates failed to download

    So for awhile now my CC has said I have to update my installed aps. When I click the update button it seems to be doing something then a few seconds later says the update has failed. I've tried restarting my PC and then trying again and I get the sam