Download File using a Revlet

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
reelstuff
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 254
Joined: Mon Apr 16, 2007 12:06 am
Contact:

Download File using a Revlet

Post by reelstuff » Fri Dec 11, 2009 3:48 pm

I have been trying to find a simple yet fairly secure method of using the revlet to download
a file from the internet,

Code: Select all

on mouseUp
   answer "Your Download will start in just a moment"
   put fld "S3File" into tURL
  launch url tURL
--also tried revGoURL, load URL, ect, to no avail, so it is obvious that this functionality does not yet exist, 
end mouseUp
Does anyone know what functions are available to the current version of the revlet?

is there a simple method of downloading a file from a URL to the users computer or browser ect, any easy way to get that file to the user.

Tim

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Re: Download File using a Revlet

Post by bn » Fri Dec 11, 2009 5:09 pm

Tim,
this works for me in a revlet. About security I don't know. You will want to decide on the saving location, which is the desktop in this case.

Code: Select all

on mouseUp
   put "http://NameOfYourDomain.com/testfile/presets/prefs.txt" into myPath
   put url myPath && the long time into field 1 -- just for testing purposes
   put url myPath into myVariable
   put specialFolderPath(desktop) & "/" into tPathToDesktop
   set the itemdelimiter to "/"
   put item - 1 of myPath after tPathToDesktop
   put myVariable into url ("file:" & tPathToDesktop)
end mouseUp
the file is in a sub-sub-folder of the public folder, you have to adjust that, other than that it just works.
If it is a text file you can test in your browser whether the url works or not.
regards
Bernd

reelstuff
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 254
Joined: Mon Apr 16, 2007 12:06 am
Contact:

Re: Download File using a Revlet

Post by reelstuff » Fri Dec 11, 2009 5:26 pm

bn wrote:Tim,
this works for me in a revlet. About security I don't know. You will want to decide on the saving location, which is the desktop in this case.

Code: Select all

on mouseUp
   put "http://NameOfYourDomain.com/testfile/presets/prefs.txt" into myPath
   put url myPath && the long time into field 1 -- just for testing purposes
   put url myPath into myVariable
   put specialFolderPath(desktop) & "/" into tPathToDesktop
   set the itemdelimiter to "/"
   put item - 1 of myPath after tPathToDesktop
   put myVariable into url ("file:" & tPathToDesktop)
end mouseUp
the file is in a sub-sub-folder of the public folder, you have to adjust that, other than that it just works.
If it is a text file you can test in your browser whether the url works or not.
regards
Bernd

It does work, thank you, I was about to pull my hair out, :mrgreen:

thank you for posting that,)

Post Reply