Created
November 5, 2012 10:23
-
-
Save Quiark/4016495 to your computer and use it in GitHub Desktop.
upload.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("#droparea").bind("drop", function(e){ | |
files = e.dataTransfer.files; | |
e.preventDefault(); | |
$.each(files,function(index,file){ | |
var form = new FormData(); | |
form.append("myFile", file); | |
$.ajax({ | |
type: "POST", | |
/* | |
beforeSend: function(request) { | |
request.setRequestHeader("Content-Type", "multipart/form-data; boundary="+boundary); | |
}, | |
*/ | |
url: "upload", | |
data: form, | |
processData: false, | |
contentType: false, | |
dataType: 'json', | |
}); | |
}).done(function(data) { }); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment