javascript - Non-ajax post using Dropzone.js -
i'm wondering if there's way make dropzone.js (http://dropzonejs.com) work standard browser post instead of ajax.
some way inject inputs type=file in dom right before submit maybe?
no. cannot manually set value of <input type='file'>
security reasons. when use javascript drag , drop features you're surpassing file input altogether. once file fetched user's computer way submit file server via ajax.
workarounds: instead serialize file or otherwise stringify , append form string, , unserialize on server side.
var base64image; var reader = new filereader(); reader.addeventlistener("load", function () { base64image = reader.result; // append base64 encoded image form , submit }, false); reader.readasdataurl(file);
perhaps you're using dropzone.js because file inputs ugly , hard style? if case, dropzone.js alternative may work you. allows create custom styled inputs can submitted form. supports drag , drop too, drag , drop cannot submit form way want. disclaimer: author of aforementioned library.
Comments
Post a Comment