Skip to content Skip to sidebar Skip to footer

Cffile Alternative, I Need To Upload Without Form Submit

So I want to upload a file to the server using ajax, so the form is not submitted. Cffile requres the filefield attribute, but as there is no form object passed to coldfusion that

Solution 1:

You can use the cffileupload tag (embeds a flash widget for uploading) , or take advantage of XMLHttpRequest level 2 (browser support) via the method explained here.


Solution 2:

Are you uploading images? You could try uploading to a canvas tag client side using javascript.

Then ajax post the base64 png encoded contents of the canvas.

Further reading and examples:

How to upload/POST multiple canvas elements

How to convert image into base64 string using javascript

Resizing an image in an HTML5 canvas

Resize image before upload, but upload synchronously (not ajax). Is it possible?

http://coding.pressbin.com/84/File-API-Resize-photo-before-upload/


Solution 3:

Submit the form to a hidden iframe and handle your form upload as you normally would.


Post a Comment for "Cffile Alternative, I Need To Upload Without Form Submit"