I'm trying to upload a file to a folder in my account on box.net. I'm using the 1.0 api version and do the upload using a post in AJAX. There's my code.
var fd = new FormData();
$('#files').change( function() {
fd.append( 'file', $('#files')[0].files[0]);
});
$( 'form' ).submit(function() {
$.ajax({
url: 'https://upload.box.net/api/1.0/upload/myauth/myfolderid?share=1',
type: 'POST',
data: fd,
contentType: false,
processData: false,
success: function(result){
alert(result);
},
error: function(result){
console.log(result);
alert(result);
}
});
});
I want to use the XML returned to store the file id for example. The problem is, it's never return success! I have no idea why!
Use the version 2.0 of the API. The api has changed.