FTP on Android

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
joel.epsteinBUS31vi
Posts: 135
Joined: Thu Sep 13, 2012 10:25 pm

FTP on Android

Post by joel.epsteinBUS31vi » Sun Nov 18, 2012 4:35 am

Hi all -

The following code is working fine on iOS, but not the Android simulator. I'd be grateful for any advice for how to make it work.

Peace

Joel

Code: Select all

   put "http://www.projectiveart.com/PAapp/count/count.txt" into countURL
   put URL countURL into tTempCount
   put tTempCount into tNumberOfFiles
   put tNumberOfFiles+1 into tNumberOfFiles
      
   constant FTPHOST = "www.projectiveart.com"
   constant FTPUSER = "{my user name}"
   constant FTPPASS = "{my password}"   
   put tNumberOfFiles into URL "binFile:/count.txt"
   put tNumberOfFiles into url ("ftp://" & FTPUSER & ":" & FTPPASS & "@" & FTPHOST&"/PAapp/count/count.txt")

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: FTP on Android

Post by Mark » Fri Nov 23, 2012 3:22 pm

hi Joel,

Which part doesn't work?

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10057
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: FTP on Android

Post by FourthWorld » Fri Nov 23, 2012 4:26 pm

joel.epsteinBUS31vi wrote:

Code: Select all

   put "http://www.projectiveart.com/PAapp/count/count.txt" into countURL
   put URL countURL into tTempCount
   put tTempCount into tNumberOfFiles
   put tNumberOfFiles+1 into tNumberOfFiles
      
   constant FTPHOST = "www.projectiveart.com"
   constant FTPUSER = "{my user name}"
   constant FTPPASS = "{my password}"   
   put tNumberOfFiles into URL "binFile:/count.txt"
   put tNumberOfFiles into url ("ftp://" & FTPUSER & ":" & FTPPASS & "@" & FTPHOST&"/PAapp/count/count.txt")
If you check "the result" after the last statement, I'd guess that you'll find an error noting the URL is invalid.

The URL being used contains a service specifier of "http", but then you prepend that with a service specifier of "ftp", giving you:

Code: Select all

ftp://user:password@http://www.projectiveart.com/PAapp/count/count.txt"
If you remove the service specifier from the URL, you'd have:

Code: Select all

ftp://user:password@www.projectiveart.com/PAapp/count/count.txt"
...which is probably what you'll need.

Note that some servers are set up to use "www.*" only for HTTP access, so you may need:

Code: Select all

ftp://user:password@projectiveart.com/PAapp/count/count.txt"
Check the value of "the result" after that call for guidance; a good practice anyway, since all sorts of errors can occur during any client-server transaction, and checking "the result" will give you the opportunity to handle those gracefully.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: FTP on Android

Post by Mark » Fri Nov 23, 2012 6:10 pm

Hi,

If I run this script, I get

ftp://{my user name}:{my password}@www.projectiveart.com/PAapp/count/count.txt

which doesn't include "http". Some servers need ftp instead of www and sometimes the correct form is ftp.projectiveart.com/www/PAapp/count/count.txt

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Post Reply