libURLDownloadToFile and cgi links

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Nonsanity
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 86
Joined: Thu May 17, 2007 9:15 pm
Contact:

libURLDownloadToFile and cgi links

Post by Nonsanity » Fri Aug 09, 2013 5:17 pm

I've been doing some web scraping of a page for downloading of listed files, but I'm encountering some difficulty with libURLDownloadToFile when the link doesn't contain the actual filename, such as when it's some sort of cgi script that then returns the actual file.

When the filename is in the url, I can extract it and pass it to libURLDownloadToFile. When it is not, I have no idea what the filename should be, and can only make a temporary filename.

When the same link is clicked in a browser however, the Save Download dialog that opens shows the correct name of the file. What I need to do is the same thing, either internally to libURLDownloadToFile so that it names the file automatically (and giving it a directory instead of a filename does not do this) or get the filename from the url by some other means first so that it can be passed to libURLDownloadToFile.

Anyone know how this can be done?
~ Nonsanity
~ Chris Innanen

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: libURLDownloadToFile and cgi links

Post by Mark » Fri Nov 15, 2013 1:33 pm

Hi Chris,

The file name should be somewhere in the libUrlLastRHHeaders function.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Post Reply