Hi
I need to send a picture taken from Androids camera to a server where mysql is running. I can do this only through port 80/8080 (http). Therefore I think I need to submit my data with the post-command. I wrote a php script that acts as API. The API-PHP script receives the data and sends them to mysql.
This works fine with normal text variables, but not with images. As they are arrays I don't know how to send them with post.
Thanks a lot for help
David
That's what I am trying with livecode (Name, Vorname, Mail and Channel work fine but tFile is not being transmitted:
set the width of the templateImage to 295
set the height of the templateImage to 170
set the left of the templateimage to "20"
set the top of the templateimage to "50"
set the lockLoc of the templateImage to true
set the name of the templateImage to "camPict"
mobilePickPhoto "Camera"
export image "camPict" to tFile as jpeg
put "Name=Rene&Vorname=rafi&Mail=mymail&Channel=22&File=" & URLEncode(tFile) into tArgList
post tArgList to URL "myserver/api.php?"
Send image with command "post"
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Send image with command "post"
You need to use base64Encode and specify what data you want to save. Your code send file path.
I would use this:
########CODE#######
mobilePickPhoto "Camera"
export image "camPict" to tFile as jpeg
put URL ("binfile:" & tFIle) into image_data
put base64Encode(image_data) into imagedata2
put urlencode("Name=Rene&Vorname=rafi&Mail=mymail&Channel=22&File=" & imagedata2) into tArgList
post tArgList to URL "myserver/api.php?"
#####END OF CODE#####
However if your image will be loadaed only by livecode, you can speedup using "the text of last image".
I would use this:
########CODE#######
mobilePickPhoto "Camera"
export image "camPict" to tFile as jpeg
put URL ("binfile:" & tFIle) into image_data
put base64Encode(image_data) into imagedata2
put urlencode("Name=Rene&Vorname=rafi&Mail=mymail&Channel=22&File=" & imagedata2) into tArgList
post tArgList to URL "myserver/api.php?"
#####END OF CODE#####
However if your image will be loadaed only by livecode, you can speedup using "the text of last image".
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
Re: Send image with command "post"
Dear MaxV
sorry for my late reply I was very busy and had to do some other stuff than programming livecode! But many thanks for your reply, which helps a lot. It's the base64encoding that does the trick. I don't know why though.
cheers and kind regards
David
sorry for my late reply I was very busy and had to do some other stuff than programming livecode! But many thanks for your reply, which helps a lot. It's the base64encoding that does the trick. I don't know why though.
cheers and kind regards
David
Re: Send image with command "post"
David,dmeier wrote: It's the base64encoding that does the trick. I don't know why though.
the base64encoding transforms any nasty chars in a standard ASCII chars. Here is the magic.

ASCII chars are standard and there aren't problem in transferring or interpreting them.
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w