Skip to content Skip to sidebar Skip to footer

Coldfusion Ajax Multi-file Upload - Cffile Overwriting Serverfile

I've taken some code from this question for the multi-file upload, which works fine but the cffile overwrites the cffile.serverFile so in the parm dump the only file name I get is

Solution 1:

Wow, by reading my own post I have figured out the problem. The callback file gets called in a loop from the JavaScript, so each time it overwrites the variables. In order to store all file names, I just simply stored them in a session variable:

<cfsetarrayAppend(session.visitor.user.tempData, "#application.domain#data/dev/#cffile.serverfile#")>

This then outputs all files uploaded and once processed by other functions, maybe to store it in the database, you can just empty the array!

Hope this helps someone :)

Post a Comment for "Coldfusion Ajax Multi-file Upload - Cffile Overwriting Serverfile"