FTP Upload on mobile device
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
FTP Upload on mobile device
Hi!
I tried to upload a created .txt-File from my app on my android-device. When I pushed the upload button it always says "App has unfortunately stopped". And my app is closed and no file is uploaded. I don't know if that is because of the FTP or not?
So I searched a bit on the forum and I don't know if I'm correct but is it the case that Livecode doesn't support FTP-Upload on a mobile device? Just for information: My FTP-code is working on the desktop-version
If so: Is there an easy possibility for an amateur like me to get an upload working?
My users do have to fill in a survey, the answers get written into a variable and then this variable should be written into a .txt-document and be uploaded onto my server so I can read it and put it into statistics.
Thanks in advance!
I tried to upload a created .txt-File from my app on my android-device. When I pushed the upload button it always says "App has unfortunately stopped". And my app is closed and no file is uploaded. I don't know if that is because of the FTP or not?
So I searched a bit on the forum and I don't know if I'm correct but is it the case that Livecode doesn't support FTP-Upload on a mobile device? Just for information: My FTP-code is working on the desktop-version
If so: Is there an easy possibility for an amateur like me to get an upload working?
My users do have to fill in a survey, the answers get written into a variable and then this variable should be written into a .txt-document and be uploaded onto my server so I can read it and put it into statistics.
Thanks in advance!
Re: FTP Upload on mobile device
Hi Flo,
did you check ALL neccessary internet stuff in the standalone builder setting on the "Android" and "Inclusions" card?
And you should always check "the result" after an action that could fail, since it may give a hint on what's going on.
Best
Klaus
did you check ALL neccessary internet stuff in the standalone builder setting on the "Android" and "Inclusions" card?
And you should always check "the result" after an action that could fail, since it may give a hint on what's going on.
Code: Select all
...
put xyz into url("ftp:"...)
if the result <> EMPTY then
answer "An Error occurred:" && the result
exit to top
end if
...
Klaus
Re: FTP Upload on mobile device
I did try various different settings, including everything I thought that is neccessary, as well as just ticking everything that's possible.Klaus wrote:Hi Flo,
did you check ALL neccessary internet stuff in the standalone builder setting on the "Android" and "Inclusions" card?
And you should always check "the result" after an action that could fail, since it may give a hint on what's going on.BestCode: Select all
... put xyz into url("ftp:"...) if the result <> EMPTY then answer "An Error occurred:" && the result exit to top end if ...
Klaus
Thanks for the result-idea! Here is the result of my error-answer on the emulator (on my android device I only get the "app stopped running"-message)
An Error occurred:
"java.io.IOException: Unable to connect to server: Unable to change directories"
Re: FTP Upload on mobile device
Hi Flo,
But I'm sure other will chime in and help you further.
Best
Klaus
OK, we have a hint, which does not tell me anything!?Flo92 wrote:An Error occurred:
"java.io.IOException: Unable to connect to server: Unable to change directories"

But I'm sure other will chime in and help you further.
Best
Klaus
-
- VIP Livecode Opensource Backer
- Posts: 10052
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: FTP Upload on mobile device
Why FTP specifically?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: FTP Upload on mobile device
There's no need for FTP. It's just really easy for an amateur like me. So I thought it would be the quickest way to get to the finish line. If you have any suggestions that work fine and ideally aren't too hard to understand for someone with relatively few experience, I'd immediately try it!
-
- VIP Livecode Opensource Backer
- Posts: 10052
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: FTP Upload on mobile device
Are these files being uploaded to your server, or do users upload to their own?
If yours, is it a shared host, VPS, or dedicated server?
If yours, is it a shared host, VPS, or dedicated server?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: FTP Upload on mobile device
It is uploaded to my server. I guess it is a shared hosting service (?). It's just some 2gb space at some german telecomunication service whereon I can also have a website running. When I enter the control center of my "hosting" I can choose between access via FTP/SSH/MySQL.
-
- VIP Livecode Opensource Backer
- Posts: 10052
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: FTP Upload on mobile device
Do you have the ability to run PHP, or a custom CGI like LiveCode?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: FTP Upload on mobile device
Well.. not yet, but I guess I'll just have to do some PHP-Tutorial then
But just to be sure: Does it work 100% with PHP
?


Re: FTP Upload on mobile device
It can be done in php or other server side script. There are some things to help you along, such as http://forums.livecode.com/viewtopic.php?f=9&t=29357 using LC server.
There are some other scripts on this forum giving sample php code somewhere too.
There are some other scripts on this forum giving sample php code somewhere too.
Re: FTP Upload on mobile device
Hi,
this code here works for me (LC 6.7.10 ("search required inclusions", permission: "Internet"), Android 5.0.1). Just tested again:
You're sure you don't use a wrong "MyURL"? You need the main URL for logging in.
The file will end in the directory connected with the assigned user. Be sure you have permissions there.
Have fun!
this code here works for me (LC 6.7.10 ("search required inclusions", permission: "Internet"), Android 5.0.1). Just tested again:
Code: Select all
on mouseUp
-- setting up Vars: --
put URLEncode("myUserName") into myUSR -- Username
put URLEncode("mySecretPassWord") into myPSW -- Password
put "myDomain.org/" into myURL -- basic Domain name
put "ftp://" & myUSR & ":" & myPSW \
& "@" & myURL into myFTPDir -- connect it
-- we need a unique filename: --
get the date && the long time
convert it to dateitems -- 2017,7,27,13,44,55,5
set itemdel to comma
delete item 7 of it
repeat for each item myItem in it
put format("%02s",myItem) after myFileName
end repeat -- => 20170727134455
-- now we push it: --
put the long system date & CR & the long system time into URL (myFTPDir & myFileName & ".txt") -- To FTP!
answer "Pushed file!" & CR & the result
end mouseUp
The file will end in the directory connected with the assigned user. Be sure you have permissions there.
Have fun!
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!
Re: FTP Upload on mobile device
Okay.. So I don't know what or if I'm doing something wrong here, but I tried exactly your code, just with my FTP-Data in my chosen app, and then - just for the case my app causes some FTP-crash - I just did a new empty project with just a button on it. Both times it worked perfectly fine on Windows, the file was uploaded with the given name but both times I get a crash on my android device. I even tried it with my phone (Android 5.1.1) as well as my tablet (Android 6.0.1).
So yeah
I don't know.. ^^
So yeah

Re: FTP Upload on mobile device
Hi,
When setting up the StandAlone I have only checked "Sign for development only", "Allow external storage" and "Internet permissions". Only the last should have a meaning here, and I'm sure you've checked it too. Any other settings are at default.
Besides, I'm using LC 6.7.10 comm. Just compiled the stack (just 1 button, as yours) with 8.1.3 comm., and it worked, too. Possible you're using tsNet? Cannot think of any other reason.
Have fun!
Really strange. I have code like this installed on various Android devices, never had problems with it (using it to provide log files/ telemetry on the FTP server).Flo92 wrote:[...] Both times it worked perfectly fine on Windows, the file was uploaded with the given name but both times I get a crash on my android device. [...]
When setting up the StandAlone I have only checked "Sign for development only", "Allow external storage" and "Internet permissions". Only the last should have a meaning here, and I'm sure you've checked it too. Any other settings are at default.
Besides, I'm using LC 6.7.10 comm. Just compiled the stack (just 1 button, as yours) with 8.1.3 comm., and it worked, too. Possible you're using tsNet? Cannot think of any other reason.
Have fun!
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!
Re: FTP Upload on mobile device
Hi Axwald!
Really awkward. Would you mind uploading only a stack with a working button for FTP-Upload - but of course deleting your login-data beforehand - so I can erase my possible mistake
?
Really awkward. Would you mind uploading only a stack with a working button for FTP-Upload - but of course deleting your login-data beforehand - so I can erase my possible mistake
