Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

CffileUpload + cffile.clientDirectory

New Here ,
May 19, 2013 May 19, 2013

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

fileupload.cfm

<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"  >  

uploadSelectedFiles.cfm

<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.

676
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 20, 2013 May 20, 2013

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:

<cfoutput>#try#</cfoutput>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 20, 2013 May 20, 2013
LATEST

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

    <cfoutput>#try#</cfoutput>.

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

    <cfoutput>#uploadFolderPath#</cfoutput>,

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.

log.txt

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
FILEWASAPPENDED: NO
FILEWASOVERWRITTEN: YES
FILEWASRENAMED: NO
FILEWASSAVED: YES
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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources