CGI to download file without URL display

LiangTyan Fui mlist at afteroffice.com
Wed Jul 10 21:50:01 EDT 2002


On 7/11/02 3:38 AM, Richard Herz wrote:

> I would like to post files on a web page for download without any display of
> the URL of the source file at the browser in order to prevent future bypass
> of download logging.  The only method I've discovered so far that has no
> display of the source file URL is to get the source file into a variable and
> "put" it back to browser as "application/octet-stream":
> 
> #!mc
> on startup
> # First log remote host address so if user bookmarks
> # this cgi file I at least log something, and/or
> # check for valid input from web form
> get url "binfile:../downloads/myApp.exe"
> put it into tBuffer
> put "Content-Type: application/octet-stream" & cr
> put "Content-Length:" && the length of tBuffer & cr & cr
> put tBuffer
> end startup
> 
> Browser then asks if you want to open or save the file.  The cgi file name
> must have the same name as the file to be downloaded (e.g., myApp.exe) in
> order for the file to be saved with that name by the browser, so the file to
> be downloaded can't be in the cgi-bin directory with the cgi script of the
> same name.

You can archive this by placing the cgi in the cgi-bin directory, but with a
little trick when link to it in the browser, Eg:
http://host.name.tld/cgi-bin/mycgi.mt/myApp.exe

The browser won't know the different, and download the file as "myApp.exe".
Tested on IE and Netscape, Windows and Mac.

> QUESTIONS: Is MC's "put" as reliable as regular browser download of a URL?
> Can I rely on the cgi host at a site provider to always be able to put a 1-3
> MB file into RAM (i.e., is this a trivial amount of ram)?  Giving the CGI

3 MB is "small" ;-)

-- 

> file the same name as the download file is no problem in Linux but would it
> be a problem on a Win server or on a Mac OS X server?
> 
> Doing a redirect with "Location:" or http-equiv="refresh" to the source file
> flashes briefly the url of source file in browser status bar, might put url
> in temp files, and might put url in Mac info comments.  If this method is
> more reliable than the direct mc "put" above, I guess a shell script could
> execute periodically to rename the source file directory.
> 
> Any other methods to use instead?
> 
> Thanks!
> Rich Herz
> herz at ucsd.edu
> http://ReactorLab.net
> 
> 
> 
> _______________________________________________
> metacard mailing list
> metacard at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/metacard




More information about the metacard mailing list