Ftp - Getting a file

Bringing the internet highway into your project? Building FTP, HTTP, email, chat or other client solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Andycal
Posts: 144
Joined: Mon Apr 10, 2006 3:04 pm

Ftp - Getting a file

Post by Andycal » Mon Mar 26, 2007 1:43 pm

Having owned RunRev for over a year, I'm finally getting chance to play with it. In particular I'd like to write something that will download a specific file from a server using FTP - can anyone point me to a resource, document or example that shows how this can be done?

Klaus
Posts: 13864
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Post by Klaus » Mon Mar 26, 2007 2:16 pm

Hi Andycal,

check the docs for "load" and "FTP" and "libURLDownloadToFile" as a start.


Regards

Klaus

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Location: Aalst, Belgium
Contact:

Post by Janschenkel » Mon Mar 26, 2007 3:22 pm

In addition to Klaus' suggestions, check out the 'URL' keyword.
Basically, it can be as easy as:

Code: Select all

on mouseUp
  ask file "Save as:"
  if it is empty then exit mouseUp
  put "binfile:" & it into tLocalPath
  put "ftp://user:password@example.net/dir/file.ext" into tRemotePath
  put URL tRemotePath into URL tLocalPath
end mouseUp
Hope this helped,

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

Andycal
Posts: 144
Joined: Mon Apr 10, 2006 3:04 pm

Post by Andycal » Fri Mar 30, 2007 8:09 am

Thanks for these guys, I'm finally starting to understand RunRev!

Andycal
Posts: 144
Joined: Mon Apr 10, 2006 3:04 pm

Post by Andycal » Wed Apr 04, 2007 8:59 am

Me again...

I've created a stack that now asks for the URL, username and password of the server. The filename, for now, is fixed. The code I have so far is this:

Code: Select all

on mouseUp 
  put "" into field "lblResult"
  if field "lblFile" is empty then exit mouseUp
  put "binfile:" & field "lblFile" into tLocalPath
  put "ftp://" & field "usernameField" & ":" & field "passwordField" & "@" & field "ftpField" & "/database.sql" into tRemotePath 
  put URL tRemotePath into URL tLocalPath 
  put the result into field "lblResult"
end mouseUp
I'm putting in nonsense data for the ftp details to force it to fail, however I'm not getting any error in the 'result' field.

Am I doing something stupid?

Post Reply

Return to “Internet”