Results 1 to 2 of 2

Thread: FileUploadField in Coldfusion problems

  1. #1

    Default FileUploadField in Coldfusion problems

    Hello,

    I am designing a component in an application that will handle uploading files. I have read the documentation on the BasicForm fileUpload in the API documentation and I have looked at the examples.

    Problem is two fold:
    I am not a PHP developer. I am working in Coldfusion.
    I also am restricted to Coldfusion 7 (before integrated JSON support)


    In the EXTJS example the PHP file called has two lines of code:
    PHP Code:
    <?php
        sleep
    (1);
        echo 
    '{success:true, file:'.json_encode($_FILES['photo-path']['name']).'}';
    Now... all this appears to be doing is returning a success message and a JSON encoded string of the filename. But it actually isn't doing anything. Its not uploading the file.

    Code:
    <cfsetting showdebugoutput="yes">
    
    <cfset Err = "">
    
    <cftry>
        <cfset destination = expandPath("../uploads_test")>
        <cfif not directoryExists(destination)>
            <cfdirectory action="create" directory="#destination#">
        </cfif>
    
        <cffile
            action="upload"
            filefield="#photo-path#"
            destination="#destination#"
            nameConflict=""makeUnique"
            result="upload">
        <cfcatch type="any">
            <cfset Err = "Still doesn't work.">
        </cfcatch>
    </cftry>
    
    <cfif Err = "">
        <cfset result = '{success:true, msg:"Worked."}'>
    <cfelse>
        <cfset result = '{success:false, msg:"#Err#"}'>
    </cfif>
    
    <CFCONTENT type="text/html" RESET="Yes">
    <CFOUTPUT>#result#</CFOUTPUT>
    My CFM page that processes Coldfusion works perfectly for all other form submission and processing EXCEPT for this annoying file upload process. And the file upload process is copied out of the coldfusion page that I originally wrote which was a standard multipart form submission.

    How exactly is this wrong? What am I doing that makes this form submission not work? I have basically copied the entire example and changed the file-upload.php to file-upload.cfm and used my already working CFM code and its broken.

    Any help or suggestions would be greatly appreciated. I have been trying this for 3 days with no success....

  2. #2
    Sencha User
    Join Date
    Apr 2008
    Posts
    365

    Default

    Sorry, I don't know coldfusion, but in general you have to take care of the upload for yourself. In php you have to check variables like:
    $sTmpFile = $_FILES['photo-path']['tmp_name'];
    $sFilename = $_FILES['photo-path']['name'];
    $nFileSize = $_FILES['photo-path']["size"];
    and then use:
    move_uploaded_file
    to copy the file from the php-tmp-upload-folder to the destination you want.

Similar Threads

  1. FileUploadField - Layout problems (3.1.1)
    By MatteoSp in forum Ext 3.x: Help & Discussion
    Replies: 7
    Last Post: 30 Apr 2010, 12:09 PM
  2. [CLOSED] Problems with FileUploadField in TableLayout
    By deepbrain in forum Ext GWT: Bugs (1.x)
    Replies: 1
    Last Post: 5 Feb 2009, 2:53 AM
  3. Problems with fileuploadfield with SSL
    By buyawebsite in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 26 Jan 2009, 2:58 AM
  4. problems with fileuploadfield and css-overrides
    By digitalkaoz in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 4 Dec 2008, 12:23 AM

Posting Permissions

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