i have write normal multiple file drag , drop uploader this,
html:
<div class="drop-box drop-area"> <form enctype="multipart/form-data" id="yourregularuploadformid"> <input type="file" name="files[]" multiple="multiple" class="hidden"> </form> </div>
script:
$('.drop-area').on( 'drop', function (e) { e.preventdefault(); e.stoppropagation(); if (e.originalevent.datatransfer) { if (e.originalevent.datatransfer.files.length) { processfileupload(e.originalevent.datatransfer.files); } } } ); function processfileupload(droppedfiles) { var uploadformdata = new formdata($("#yourregularuploadformid")[0]); if (droppedfiles.length > 0) { (var f = 0; f < droppedfiles.length; f++) { uploadformdata.append("files[]", droppedfiles[f]); } } $.ajax({ url: "files.php", type: "post", data: uploadformdata, cache: false, contenttype: false, processdata: false, success: function (ret) { alert("file uploaded !"); }, }); }
i have upload folder,nested folder too(dir). how ? got this. can possible. don't need use library this. (it must work ie10)
for chrome >= 21, works chrome 21 drag , drop
Comments
Post a Comment