cffile uploadall not returning serverfile
Copy link to clipboard
Copied
Hi All,
We just updated to cf11 from cf9. Just found out that our uploader is no longer working. The files are uploading fine but the return variable is no longer present. I used to have a variable #serverfile# which returned me the renamed file that was uploaded in cf9. Now i get this error:
Element SERVERFILE is undefined in FILE.
So I tried to add a result attribute to the cffile uploadall call and access via "name.serverFile" and i get this error:
You have attempted to dereference a scalar variable of type class coldfusion.runtime.Array as a structure with members.
So I tried just my result name and I do see an error with details of the file uploaded:
Invalid data [{CLIENTDIRECTORY={},CLIENTFILE={fallen tree.pdf},FILEWASAPPENDED={false},FILESIZE={70798},CONTENTTYPE={application},SERVERFILE={fallen tree12.pdf},CLIENTFILEEXT={pdf},TIMECREATED={{ts '2015-08-24 14:34:53'}},CONTENTSUBTYPE={octet-stream},FILEMODESET={false},FILEWASSAVED={true},OLDFILESIZE={70798},SERVERFILENAME={fallen tree12},FILEATTRIBSET={false},TIMELASTMODIFIED={{ts '2015-08-24 14:34:53'}},ATTEMPTEDSERVERFILE={fallen tree.pdf},DATELASTACCESSED={{d '2015-08-24'}},SERVERFILEEXT={pdf},FILEWASRENAMED={true},SERVERDIRECTORY={\\INSITECF\InSite_Data\iNCompliance_Files},FILEEXISTED={true},FILEWASOVERWRITTEN={false},CLIENTFILENAME={fallen tree}}] for CFSQLTYPE CF_SQL_VARCHAR.
So in this result I do see all the attributes of the file, but my question is how do I call out each one individually? I just want the serverfile that is returned.
Thanks!
Copy link to clipboard
Copied
Uploadall returns an array of results. Which is why you are getting the error about deferencing.
As there will be multiple files in the uploadall post you will need to take the result and use it like you would any other array. So loop over it etc.
Just because you are uploading 1 file doesn't change this. If you are just always uploading 1 file then use the upload action instead.
with regards to it "worked but now it doesn't", this will most likely be because it was working in correctly and has now been sorted in CF11
cffile action = "uploadAll" - ColdFusion, English documentation - Adobe Learning Resources

