Last active
February 21, 2017 09:44
-
-
Save drawcode/1be19966d79e1e81392ecbc68fc6044b to your computer and use it in GitHub Desktop.
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
var fileUpload = $(".files-upload").get(0); | |
var files = fileUpload.files; | |
var data = new FormData(); | |
for (var i = 0; i < files.length ; i++) { | |
data.append(files[i].name, files[i]); | |
} | |
data.append("test", "1"); | |
$.ajax({ | |
type: "POST", | |
url: "/api/v1/files/", | |
contentType: false, | |
processData: false, | |
data: data, | |
success: function (message) { | |
console.log(message); | |
}, | |
error: function () { | |
console.log("There was error uploading files!"); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment