File uploading issue

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.

Hi Daxeel,
Please, use our JS SDK to solve this issue, it will be the easier way.
Here you can find the suitable example.
Regards, Ilya.

Cool! Thanks.

Where to pass my app-id & js-key in JS SDK?
They have not mentioned here.

https://backendless.com/documentation/users/js/users_requirements.htm

Got it.

Backendless.initApp( application-Id, secret-key, version )