Page 1 of 1

Ftp - Getting a file

Posted: Mon Mar 26, 2007 1:43 pm
by Andycal
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?

Posted: Mon Mar 26, 2007 2:16 pm
by Klaus
Hi Andycal,

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


Regards

Klaus

Posted: Mon Mar 26, 2007 3:22 pm
by Janschenkel
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.

Posted: Fri Mar 30, 2007 8:09 am
by Andycal
Thanks for these guys, I'm finally starting to understand RunRev!

Posted: Wed Apr 04, 2007 8:59 am
by Andycal
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?