I am using REST API for image upload.
Here is my HTML,
<input type="file" class="btn btn-default col-md-12" id="push_media">
Here is JS
var push_media = $("#push_media")[0].files[0];
$.ajax({
"async": true,
"crossDomain": true,
"url": "http://api.backendless.com/v1/files/push_media/image_name.png",
"type": "POST",
"headers": {
"application-id": "XYZ",
"secret-key": "XYZ",
"application-type": "REST",
},
"mimeType": "multipart/form-data",
"data": "file=@"+push_media.name,
success: function(xml, textStatus, xhr) {
console.log(xhr.responseJSON);
},
complete: function(xhr, textStatus) {
console.log(xhr.responseJSON);
}
});
So what is the issue? I can’t figure it out.