how to download an image

Mark Wieder ahsoftware at sonic.net
Sun Jun 4 13:56:22 EDT 2017


On 06/04/2017 10:06 AM, Matt Maier via use-livecode wrote:
> Hokay, so, apparently post is a blocking command, which is a bad idea for
> multiple potentially large files. So I'm trying to use this, but it's still
> downloading 1kb files.
> 
> *put* "https:" & tImgUrl into tImgUrl
> 
> *set* itemdelimiter to "/"
> 
> *put* item -1 of tImgUrl into tImgName
> 
> *set* itemdelimiter to comma
> 
> *put* tNewFolder & "/" & tImgName into tNewFile
> 
> libURLDownloadToFile tImgUrl,tNewFile

Multiple unknowns here.
First of all, you're conflating 'post' and 'downloading' which is muchly 
confusing.

I assume that tImgUrl starts with "//" at the start of this code. 
Otherwise you'll need to add it after the "https:" prefix.

And don't you want a callback message to make it asynchronous?
And remember to check the URLStatus in the callback handler.

-- 
  Mark Wieder
  ahsoftware at gmail.com




More information about the use-livecode mailing list