2 Replies Latest reply: May 20, 2013 5:25 PM by Sree Viji RSS

    CffileUpload + cffile.clientDirectory

    Sree Viji

      I am new to coldfusion. I am using coldfusion-10. I am trying to upload multiple image files using cffileupload. I am able to upload files as expected. But I would like to get the metadata before uploading and get the clientFileDirectory of the uploaded files. PFB code


      <cffileupload  name = "uploadDemo"  url="uploadSelectedFiles.cfm"  progressbar="true"  addButtonLabel = "Select File(s)"  clearButtonLabel = "Clear"  width="500"  height="400"  title="Choose Files To Upload"  maxUploadSize="1"  maxFileSelect="10"  extensionfilter="*.gif,*.jpg,*.png,*.doc"  uploadButtonLabel="Upload"  onComplete="previewfile"  >  


      <cffile action="uploadall" destination="#expandpath('.')#"  nameconflict="makeUnique" result="uploadResult" />  <cfoutput>try</cfoutput>  <cfdump var="#cffile#">  

      But cffile.clientDirectory throws an Status code :500 (unable to upload files too....).One more info, I am not able to view the 'try' string output in the main page (file upload page). Please help...I am posting this afresh to draw more attention and get quicker reply.

        • 1. Re: CffileUpload + cffile.clientDirectory
          BKBK MVP

          There are 2 things: the 500 error and the display of 'try'. I suspect the error is caused by the attribute onComplete="previewfile". The Javascript it points to may have an error. Remove the attribute, and see what happens.


          To print the string, enclose it with the # symbol, as follows:



          • 2. Re: CffileUpload + cffile.clientDirectory
            Sree Viji Community Member

            Hi BKBK,


            Thank you so much for the reply. I removed the onComplete="previewfile" and the error 500 disappears now.


            I am looking for cffile.clientDirectory information, but unable to get it.PLEASE HELP....I am in dire need of that info. I am not getting it for any uploaded file. PFB my trials.



            I tried




            Nothing is displayed yet and it gives status 500 error (because try is not defined anywhere). I tried 




            no error, no display (or output too). Nevermind, that's not very important.


            I tried


                <cfdump    var="#uploadResult#"    label="Upload Meta Data"    output="#expandPath( './log.txt' )#"    format="text"    />


            and the logs are available now. I am fine with it.




            Upload Meta Data - array - Top 1 of 1 rows

            1) [struct]
            ATTEMPTEDSERVERFILE: cat.jpg
            CLIENTDIRECTORY: [empty string]
            CLIENTFILE: cat.jpg
            CLIENTFILEEXT: jpg
            CLIENTFILENAME: cat
            CONTENTSUBTYPE: octet-stream
            CONTENTTYPE: application
            DATELASTACCESSED: {d '2013-05-20'}
            FILEEXISTED: YES
            FILESIZE: 446759
            OLDFILESIZE: 446759
            SERVERDIRECTORY: E:\Inetpub\wwwroot\cdd\Portfolio\eKris
            SERVERFILE: cat.jpg
            SERVERFILEEXT: jpg
            SERVERFILENAME: cat
            TIMECREATED: {ts '2013-05-20 17:35:57'}
            TIMELASTMODIFIED: {ts '2013-05-20 17:35:57'}


            Message was edited by: Sree Viji