Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Uploading pics

Hi Juan,

It seems facebook api does not recognize your file field.

Here is two possible reason i see:

1 Wrong file field name. (check it out).

2 Wrong request format(as you've mentioned before "try to use multipart/form-data".

Also, please open browser debugger on network tab and take a look on this request parameters.

Regards.

Juan Story
Posts: 0
Joined: Wed Nov 05, 2014 8:31 pm

Uploading pics

Hi Yurii,

1- The form data name is definitely "source" as stated in official Facebook docs: https://developers.facebook.com/docs/...

What i don't really know is if i am oinvoking the service correctly from code. You suggested to use the "parameters" key word for the access_token query string field, but im not sure if the "data" field on the Body section of the service should be populated as i am doing. The only thing i found as reference is: http://devcenter.appery.io/documentat...

Could you please specify how i should populate the data parameter if i am doing it wrong?

2- I also overrode the request Content-Type field with multipart/form-data instead of application/octet-stream but it didn't change anything

Thanks

Juan Story
Posts: 0
Joined: Wed Nov 05, 2014 8:31 pm

Uploading pics

Any news regarding this?

Honestly im a bit dissapointed that this has to be so difficult and that no proper documentation exists for this use case. Its great that you have a thorough tutorial on posting status updates, but uploading a picture is one of the most frequent use cases one may encounter and not having a minimum documentation on this is a bit underwhelming.

Imo, having this kind of guides (uploading images to facebook, twitter, and using more advanced features with this platforms) would be a great addition to the current documentation, as the state of implementing this third party integrations is not so trivial as one would want to expect from an "app builder" platform.

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Uploading pics

Dear Juan,

Sorry to hear that you are disappointed. But your question requires pure custom JavaScript, what is something outside the scope of our support http://devcenter.appery.io/support-po....
You may consider purchasing Advisory Pack to get more in-depth help on this question. Here is more information about Advisory Pack http://appery.io/services/.

We are working on documentation and will review such request.

Juan Story
Posts: 0
Joined: Wed Nov 05, 2014 8:31 pm

Uploading pics

Hi Alena,

Well, i hadn't seen that support policy page before, so now i know that my request doesn't fall in the "covered" section 100%, hence the thorughness of the replies i've been given is somewhat understandable. My apologies on that.

Nevertheless, i don't completely agree that my request is completely in the "not covered" section, as it is related to an official appery plugin, and its not that i'm implementing my own custom service or something of that sort. Also my last question was about setting the parameters correctly in a "data" type request, which is a plain Appery feature.

What i find difficult to accept is that nobody has come across a solution to this use case and published a description of how to populate the parameters needed to make this kind of request to Facebook. I mean, there is pleanty of coumentation on how to do this on pure JS, but not how to do it using Appery's service model.

Sorry if i'm expecting to much of the support/platform, but i have spent so much time trying to make this simple request work that i am worried about it.

Thanks

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Uploading pics

Hello Juan,

Sorry for the radio silence here. You should to debug your app, you may use Weinre (http://devcenter.appery.io/documentat...)

Juan Story
Posts: 0
Joined: Wed Nov 05, 2014 8:31 pm

Uploading pics

Hi Evgene,

I've already debugged the app, both locally and ion a device with weinre, but everything works fine except that the response from facebook is "(#324) Requires upload file" as i mentioned before. No other error or warning is shown.
Obviously there is something wrong with the way im sending the photo data, but from what i could tell from Facebook docs and googleing around, all the JS is fine, mostly as shown here:

http://stackoverflow.com/questions/16...

So the JS steps would be:

1-Getting the image as base64 encoded string (i use a predefined one "hardcoded" to a string variable. I've tested, and the encoded string is right).
2-Transforming it into a BLOB (Facebook doesn't like base64)
3-Appending it to a FormData with its name as "source" (as shown in FB api docs)
4-Using that as the "data" parameter in the service call.

I assume the problem must be around step 4, as it is the only one that really differs from the others solutions as it is an Appery.io specific implementation.

So, again, what i'm trying to guess is how to send the image blob using an Appery.io service invokation. Must it be of type data? or JSON? mut i change the type to multipart/form-data manually?
I've tried all this woithout success, but i cannot possibly try out all combinations of parameters types and ways to send the image until i arrive to the correct implementation.

Thanks

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Uploading pics

Hello Juan,

1)To send blob data you should make post request.
Please add parameter that requires Facebook and set it's value to your blob.
2) You can try to make custom implementation of your request and append your data to the formData by yourself.
In this tutorial you can find code how to use blob in appery REST service custom implementation. Instead text/html mime-type you need to use image/jpeg, or other.
http://blog.bismallion.com/sending-em...

Juan Story
Posts: 0
Joined: Wed Nov 05, 2014 8:31 pm

Uploading pics

Hello

Sorry for delay in my reply; i left this issue for later as there were more pressing requirements in the project.
I resumed this recently and gladly i was able to make it work using a pure JS implementation (as described in one of the Stackoverflow links that i posted before).
I tested it on the web version, and on my Android phone (Moto G second generation) and i was able to succesfully share an image to Facebook. Regardless of this, i was surprised to find out that on my android tablet an error poped. The tablet is a Samsung Galaxy Tab 2 7" with Android 4.2, Chrome 39, and the latest Apperyio tester app.

More specifically the error happens when trying to generate the blob, as it throws "TypeError: Illegal constructor".
I found a similar issue in this thread: https://getsatisfaction.com/apperyio/...

And tried the exact code to create the blob and the result was exactly the same: works everywhere except on my tablet.

I also tried solutions like this: http://stackoverflow.com/questions/15...
but they were unseccessful as well.

Any ideas on what i might be doing wrong, or what can be causing this? Is it an Appery issue, a phonegap issue, a code issue, an android issue? i'm a bit lost here and i'm afraid that leaving it to "it works in some phones and not on others for some misterious reason" won't cut it for the project.

Thanks!

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Uploading pics

Hi Juan,

Please use WEINRE debugger to debug your code.

Details: http://devcenter.appery.io/documentat...

Use "console.log()" code to understand what is wrong in your code and why and exactly on what code line you have error.

Regards.

Return to “Issues”