Created
November 14, 2014 05:05
-
-
Save wayanjimmy/d07d13927739c3482e76 to your computer and use it in GitHub Desktop.
jquery ajax fileupload
This file contains hidden or 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
$('#file').change(function(){ | |
var formData = new FormData(); | |
var current = $(this); | |
formData.append("file", $(this)[0].files[0]); | |
// additional data | |
formData.append("id", "1"); | |
var promise = $.ajax({ | |
url: "url", | |
type: 'post', | |
data: formData, | |
processData: false, | |
contentType: false | |
}); | |
promise.done(function(result){ | |
// event when upload done | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment