Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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!");
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement