public
Last active

Example of FormaData for Chrome and Firefox

  • Download Gist
gistfile1.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11
$.each(dataTransfer.files, function ( i, file ) {
var xhr = new XMLHttpRequest();
var upload = xhr.upload;
var formdata = new FormData();
 
//formdata.append("session",socket.transport.sessionid);
formdata.append('mycustomfieldforfile', file);
xhr.open("POST", "/post/file");
xhr.send(formdata);
 
});

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.