In my mobile application, i got a card which is like a sign up card ~ In this card, user need to input details and when they press the sign up button , the details will be sent to my own website. In this card, there is a username , password and image data to be submit to my website.
The username and password can be submitted but image can't be submit anybody know how i can make the image data to be sent??
on mousedown
create image "profilepicture"
put "*.jpg;*.gif;*.png" into types
if there is not an image "profilepicture" then
answer "please insert image"
end if
answer file "Select file" with type types
if it is empty then exit mousedown
put it into fn
if there is a file fn then
set the fileName of image "profilepicture" to fn
else
answer "please insert image"
end if
end mousedown
answer "Are you sure you want to signup?" with "No" and "Yes"
if it is "Yes" then
put field "username" into username
put field "password" into password
put image "profilepicture" into profilepicture
put "username="&username&" && password="&password&" && image="&profilepicture&"" into myData
post myData to URL "https://example.com/signup""
answer "Submited Successfully!"
go to card "logincard"
end if
end mouseup
Erm, I would say that yes, imageData is the reference that (probably) is universal, *but* that doesn't necessarily imply it is ... easily transferrable, I guess. I recently went through a similar problem, one language I use created images suitable for storing and retrieving easily from a db, regardless of the original size of the image, I was easily able to display it again.
However, in re-writing that retrieval for Lc, it hasn't turned out as simple as I might have liked. I actually had to get the images out and saved in the other language, then stuff them back in with Lc.
It kind of depends on the server side what you need to do to send it.
Are you using LC Server to handle the data posted to it? Or php? Can we see some of the code used to receive and process the posted data.
Then we can see what kind of data formatting to do to match what it wants to receive.
put field "username" into username
put field "password" into password
put image "profilepicture" into profilepicture
put "username="&username&" && password="&password&" && image="&profilepicture&"" into myData
post myData to URL "https://example.com/signup""
answer it
The answer dialog box is empty but all data go thru except for the image ~ ~
SparkOut wrote: Mon Jun 04, 2018 8:15 am
It kind of depends on the server side what you need to do to send it.
Are you using LC Server to handle the data posted to it? Or php? Can we see some of the code used to receive and process the posted data.
Then we can see what kind of data formatting to do to match what it wants to receive.
on mousedown
answer "Are you sure you want to add?" with "No" and "Yes"
if it is "Yes" then answer "Confirm?" with "No" and "Yes"
if it is "Yes" then
put empty into tForm
put "https://example.com/signup" into tURL
put img "profilepicture" into tImage
put fld "username" into tUserName
put fld "password" into tPassword
put filename of img "profilepicture" into imgpath
put "<file>" & imgpath into tImage
put "image," & tImage into tArray[1]
put "username," & tUserName into tArray[2]
put "password," & tPassword into tArray[3]
if libUrlMultipartFormData(tForm, tArray) is not empty then
answer it ##error
else
set the httpHeaders to line 1 of tForm
post line 2 to -1 of tForm to url tURL
## check the result, etc., here
set the httpHeaders to empty
end if
end if
end mousedown