CGI script to count downloads

Steve Purcell stephen_purcell at yahoo.com
Wed Apr 4 08:41:11 EDT 2001


Greg Ewing wrote:
> For instance, if the URL used to retrieve the
> file is
> 
>   download.py?file=download/akaroa2.6.1doc.tar.gz
> 
> then the default filename that Netscape gives me
> is
> 
>   akaroa2.6.1doc.tar.py
> 
> So, my question is, can I put anything in the
> headers of the response to give the browser a
> hint as to what name the file should be saved
> under?


There aren't any headers that can help, AFAIK. But... you can instead make
the URL look like this:

   download.py/download/akaroa2.6.1doc.tar.gz

Browsers will determine the correct filename from this URL, and 'download.py'
can access the filename argument using the CGI variable "PATH_INFO".

-Steve


-- 
Steve Purcell, Pythangelist
Get testing at http://pyunit.sourceforge.net/
Any opinions expressed herein are my own and not necessarily those of Yahoo




More information about the Python-list mailing list