HTML5 XHR Image Uploader - Chrome Extension -- 2

Ολοκληρωμένο Αναρτήθηκε Aug 25, 2014 Πληρώθηκε κατά την παράδοση
Ολοκληρωμένο Πληρώθηκε κατά την παράδοση

Hi,

I currently have a Chrome Extension which you can download here.

[url removed, login to view]

The extension allows the user to take screen captures of any website and then upload them to my website.

However, due to updating my script, instead of using a flash based uploader - it now uses HTML5.

Any attempt to upload an image via the extension would result in uploading a small brown box.

I asked the developer of the script why, and this is what he said.....

My Message:

--------------------

I have modified my Google Chrome extension to work with V3 as this uses POST, however when I upload the file, I'm still getting the small brown box??

Can you spot anything wrong with this piece of code??

[Code]

function uploadImage(website, callback) {

try {

if (website == "ultraimg") {

ajaxObj = $.ajax({

url: "[url removed, login to view]",

type: "POST",

timeout: 45000,

data:{key:"3374fa58c672fcaad8dab979f7687397", source: encodeURIComponent([url removed, login to view]().replace(/^data:image\/(png|jpg);base64,/, ""))},

dataType: "json",

success: function(data) {

if(data.status_code == 200) {

var imageURL = data.image.display_url;

var htmlURL = '<img src="' + data.image.display_url + '" border="0" />';

var BBCodeURL = "[IMG]" + data.image.display_url + "[/IMG]";

callback({imageURL:imageURL, htmlURL:htmlURL, BBCodeURL:BBCodeURL});

[url removed, login to view](imageURL);

return;

}

else {

callback({error:"Error: " + data.status_code + " - " + data.status_txt});

}

}

});

}

} catch (e) {

callback({error:"Error: " + e + ". Please try later or try another upload site!"});

}

}

[/code]

A similar code used to work with Version 2 of Chevereto, but since V3, I've always received the brown box? :S

However other programs such as ShareX works perfectly fine :S

The API response code for the direct link was [url removed, login to view]

As far as I can tell, I'm not using the GET method here? So why the brown box still ?

His Response:

----------------------

It won't work because you are sending the data using $.ajax and converting the base64 string. PHP base64 string is very sensitive and if the string has the slightest issue it won't work.

If you notice in Chevereto uploader I use the direct HTML 5 XHR to upload the files because every time I used the base64 implementation from javascript it didn't work. So I ended up emulating a html file form.

//////

I presume his last sentence was referring to the actual website script.

So anyway, as you can see, at the moment MY code doesn't work... However, it might work if it's converted to use HTML5 XHR ?? I'm not entirely sure if that's possible or if I'm asking the correct question.

Feel free to download my extension that I linked to above and try to edit the file called... '[url removed, login to view]' - within the 'js' folder.

If you are able to get the screen captured images uploaded and working 100%, and are also able to get the correct API responses then I will be very happy to work with you.

Thank you for reading my project.

HTML5 PHP XML

Ταυτότητα Εργασίας: #6369847

Σχετικά με την εργασία

1 πρόταση Απομακρυσμένη εργασία Ενεργό Aug 25, 2014

Ανατέθηκε στον:

nSolutionsPL

Nie złożono jeszcze oferty.

$30 USD σε 0 μέρες
(33 Αξιολογήσεις)
5.1