Help needed downloading a file to a folder

Andre Garzia soapdog at
Sat Dec 3 01:41:30 EST 2005

On Dec 3, 2005, at 4:31 AM, Rodney Somerstein wrote:

> Andre,
> Thanks for the quick answer. Using the correct URL does seem to  
> help. ;-)
> It seems to work OK now. Though as you state, I don't want that  
> long pause while the file downloads. Of course, the next obvious  
> question is how do I use the load URL command to the same thing?  
> From what I can tell, load URL puts the file into memory. I then  
> need to save it to disk but have no idea how to do so.
> Also, I noticed that instead of ending up with a binary file when  
> using put URL, I actually ended up with a text file with a .zip  
> extension. It did unzip with no problem. I'm guessing I have to do  
> some kind of magic to make the file into an actual zip file for Mac  
> OS X?
> Thanks again,
> -Rodney


glad I could help. One of the best places to learn about the commands  
is the built in Dictionary, you just launch the documentation from  
the help menu and chose dictionary, all your commands are there with  
nice explanations. I spend more time in the docs than actually  
coding ;-)

the load url command will cache a URL for you. One of the formats  
used is:

load URL <the url>, <the callback message>

So you can use a code like this in your app.

on mouseUp
   load URL "", "downloadDone
end mouseUp

on downloadDone
   put URL "" into  
end downloadDone

The load URL command will cache a URL, all subsequent calls to that  
URL will use the cached version, pretty handy! As for the zipfile  
looking like text, that happens due to macintosh type/creator codes.  
You must set them for the finder to recognize the file as zip, it's  
pretty easy, you just use:

set the fileType to <type creator/code>

before writing the file, I can't recall type creator codes for zip  
files from memory, but googling for them you'll find the answer.
Cheers and welcome

More information about the Use-livecode mailing list