Upload multiple files with jquery and coldfusion cffile Upload multiple files with jquery and coldfusion cffile ajax ajax

Upload multiple files with jquery and coldfusion cffile


Here's my solution to a similar issue another user had, which I resolved still utilizing the HTML5 "multiple" attribute for file uploads. You can still upload the form as you normally would, which would POST multiple files to the server. Rather than using CF's file upload utilities, you can simply loop over the form data and do the individual writes yourself, giving you full server-side control of the file details in a single request.

ColdFusion handling of HTML5 <input type="file" multiple="multiple" />


My suggestion to you would be to post them as dataUrl's if you have the ability to you can send multiple strings at a time for your post. You actually don't need a form at all to post images as data strings. I worked on a project recently where I had to use angularjs to create a file upload. If you don't even have to use a form. You can send it as an array of dataURLs and loop through them in your cfc. Alternatively you can can use a library like the jquery uploadify or something like that if backward compatibility is an issue. If you are interested in how to setup looping through DataURL's and saving them since they are images I will post the code.