how to post file to server?

67 views
Skip to first unread message

agnes van

unread,
May 7, 2019, 2:55:00 AM5/7/19
to MIT App Inventor Forum
hello

i want to post file to api server but i got an error message 502. i dont know how, somebody can teach me, please?

thankyou.. 

regards,

agnes

SteveJG

unread,
May 7, 2019, 9:55:54 AM5/7/19
to MIT App Inventor Forum
How are you trying to 'post' your file to the api server?   What api server are you trying to post to?   502 indicates you cannot contact the server.   Does the server require an api password?   If so, did you provide it in your posting request?

Unfortunately, you did not post an image of your Blocks here in the Forum Agnes which means we cannot tell what you are trying to do.   Post an image of your Blocks and someone will provide specific advice.

Regards,
Steve

agnes van

unread,
May 7, 2019, 12:32:27 PM5/7/19
to MIT App Inventor Forum
Hello Steve,

Sorry my fault.. Here is my code blocks. so, when i clicked button "Upload", i got this error message status : 502. i think the problem because web1.postfile that i sent is not correct. in my api, needs keyword name "foto", but i don't know where i put the keyword in my code blocks. should i use PostText in my codeblocks same time?

Thankyou..

Regards,
agnes

blocks(1).png


Taifun

unread,
May 7, 2019, 1:59:08 PM5/7/19
to MIT App Inventor Forum
 in my api, needs keyword name "foto",
can you tell us more about your API? any documentation link?
see also 

How to use the PostFile block in App Inventor


Taifun

Trying to push the limits of App Inventor! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun. 

agnes van

unread,
May 7, 2019, 8:58:44 PM5/7/19
to MIT App Inventor Forum
Hello Taifun,
This is my api.. when i test in my api,choose file image as value with key name"foto", i will get status response 200, which means file image that i have send is succesfully. but, when i try to post image using mit app inventor, i got status response 502, which means file image that i have send unsuccesful. i think my code blocks has a wrong way, can you tell me where is? 

Thankyou,
Agnes

api.png



agnes van

unread,
May 7, 2019, 9:11:08 PM5/7/19
to MIT App Inventor Forum
Taifun, 

i have seen your link and follow the code blocks. but, you used web1.url with php file and it not same with my url. my api connect to database sql server. is that have different way in code blocks? 

thankyou,
agnes

Taifun

unread,
May 8, 2019, 8:53:15 AM5/8/19
to MIT App Inventor Forum
the web component does not support multipart/formdata
Taifun

111 111

unread,
May 8, 2019, 10:43:49 AM5/8/19
to MIT App Inventor Forum
Excuse me ,may i ask a question is about the ocr  scan the image and convert it to text which program you had done it before.we are fresh men at create app,and we want to reference your porgram ,but it would occur some mistakes .Could you give us some advice?i'm sorry to bother you.
Screenshot_20190508-222749.jpg

Taifun

unread,
May 8, 2019, 7:44:03 PM5/8/19
to MIT App Inventor Forum
@111 111 for new questions, please start a new thread
protip: do a search in the forum...
Taifun

agnes van

unread,
May 9, 2019, 3:37:05 AM5/9/19
to MIT App Inventor Forum
Hello Taifun,

Thank you for your answers, so what should I do? I don't know what the solution :( help me, please.

Thank you,
Agnes

Taifun

unread,
May 9, 2019, 8:15:17 AM5/9/19
to MIT App Inventor Forum
the simplest solution to transfer a file to a server is to use ftp
here is a ftp extension https://puravidaapps.com/ftp.php
Reply all
Reply to author
Forward
0 new messages