Home > parsing error > parsing error in the name of the uploaded file

Parsing Error In The Name Of The Uploaded File

on Stack Overflow. Help Google Group Stack Overflow Uploading files to Parse using JavaScript and the REST API 11 votes 1 answer 70.8k views over 2 years ago RocketReel Admin I'm trying to upload image files to Parse.com via the REST API, but although I am getting a file_url back, the images themselves are showing as broken links. For instance, I uploaded an image and got back the following url: http://files.parse.com/e54abb9b-6acf-4380-9f7f-acac75586d40/bd22f884-9081-4f3d-a5a3-834544d1fd99-Hydrangeas.jpg But when I go to it, there is just a broken image link. I'm not getting an error on upload, as far as I can see... what could I be doing wrong? Here's my upload code (file is the file which was uploaded): var serverUrl = 'https://api.parse.com/1/files/' + file.name; $.ajax({ type: "POST", beforeSend: function(request) { request.setRequestHeader("X-Parse-Application-Id", 'MY-APP-ID'); request.setRequestHeader("X-Parse-REST-API-Key", 'MY-REST-API-ID'); request.setRequestHeader("Content-Type", file.type); }, url: serverUrl, data: file, processData: false, contentType: false, async: false, success: function(data) { var fileitem = self.fileList[ii]; }, error: function(data) { var obj = jQuery.parseJSON(data); alert(obj.error); } }); I'm very new to Parse, so it's probably something stupid! Thanks! 1 Answer Héctor Ramos Parser Your code looks correct (although I'd suggest setting async to true, which is the default value). How are you selecting the file to be uploaded? Tiggzi has an example of how you can use JavaScript to upload files to Parse, which I have adapted into the following. Perhaps you can give it a try and let me know if that works for you.

 

© Copyright 2019|winbytes.org.