To Upload picture from Mobile to FTP ?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 13
- Joined: Wed Feb 25, 2015 2:15 pm
To Upload picture from Mobile to FTP ?
I make an App from which I can upload easily picture from destop to my FTP but from my mobile I cannot upload to FTP. someone can help me ? please here is my code:
on mouseup
global id_crt
add 1 to id_crt
put "/"& id_crt &".png" into cs
put image "picture" into tImageUpload
put "ftp://"&Username&":"&password&"@"&"host/filepath" & cs into uploadURL
libURLftpUpload tImageUpload,uploadURL
if the result is not empty then
answer "url put failed:" && the result
else
answer "Upload is done!"
end if
end mouseUp
on mouseup
global id_crt
add 1 to id_crt
put "/"& id_crt &".png" into cs
put image "picture" into tImageUpload
put "ftp://"&Username&":"&password&"@"&"host/filepath" & cs into uploadURL
libURLftpUpload tImageUpload,uploadURL
if the result is not empty then
answer "url put failed:" && the result
else
answer "Upload is done!"
end if
end mouseUp
-
- Livecode Opensource Backer
- Posts: 1336
- Joined: Sun Jul 12, 2009 10:53 am
- Location: Bordeaux, France
Re: To Upload picture from Mobile to FTP ?
from the iOS release notes..
Note: When using URLs for these protocols be aware that the iOS system functions used to provide them are much stricter with regards the format of URLs – they must be of the appropriate form as specified by the RFC standards. In particular, in FTP urls, be careful to ensure you urlEncode any username and password fields appropriately (libUrl will allow characters such as '@' in the username portion and still work – iOS will not be so forgiving).
To upload a file to an FTP server, do something like...
Note: When using URLs for these protocols be aware that the iOS system functions used to provide them are much stricter with regards the format of URLs – they must be of the appropriate form as specified by the RFC standards. In particular, in FTP urls, be careful to ensure you urlEncode any username and password fields appropriately (libUrl will allow characters such as '@' in the username portion and still work – iOS will not be so forgiving).
To upload a file to an FTP server, do something like...
Code: Select all
put tData into url "ftp://ftp.server.com"
-
- Posts: 13
- Joined: Wed Feb 25, 2015 2:15 pm
Re: To Upload picture from Mobile to FTP ?
I try it but not working
Re: To Upload picture from Mobile to FTP ?
Cher monsieur mulandc@yahoo.fr,
no idea why you post this in the ANNOUNCEMENT section?
Will move this to the beginner thread.
Best
Klaus
no idea why you post this in the ANNOUNCEMENT section?
Will move this to the beginner thread.
Best
Klaus
-
- Posts: 13
- Joined: Wed Feb 25, 2015 2:15 pm
Re: To Upload picture from Mobile to FTP ?
I think I solved the problem. the code looks like that:
on mouseup
global id_crt
add 1 to id_crt
put "/"& id_crt &".png" into cs
export image "picture" to file specialFolderPath("camera")& "/id_crt.png" as PNG
put url ("binfile:" & specialFolderPath("documents") & "/id_crt.png") into tImageUpload
put tImageUpload into url ("ftp://"&Username&":"&password&"@"&"host/filepath" & cs)
if the result is not empty then
answer "url put failed:" && the result
else
answer "Upload is done!"
end if
end mouseUp
on mouseup
global id_crt
add 1 to id_crt
put "/"& id_crt &".png" into cs
export image "picture" to file specialFolderPath("camera")& "/id_crt.png" as PNG
put url ("binfile:" & specialFolderPath("documents") & "/id_crt.png") into tImageUpload
put tImageUpload into url ("ftp://"&Username&":"&password&"@"&"host/filepath" & cs)
if the result is not empty then
answer "url put failed:" && the result
else
answer "Upload is done!"
end if
end mouseUp
Re: To Upload picture from Mobile to FTP ?
Really?specialFolderPath("camera")
Are you sure?