How to save a file on a users computer with cgi

Paul Boddie paul at boddie.net
Fri Jan 4 11:46:46 EST 2002


bragiba at simi.is (Bragi Baldursson) wrote in message news:<abcf4a18.0201040208.2bda19d9 at posting.google.com>...
> I am writing a small cgi script that I would like to write a small
> file with user relevant information to his/her hard disk.
> How do I accomplish this?

The best you can achieve is probably to send content of a certain type
as a response to a user's HTTP request, resulting in that user's
browser prompting them to save the document to disk. You would need to
choose the content type carefully to avoid the browser displaying the
content in its window, and you might want to set the "content
disposition" header to suggest a filename to be used when the data is
saved.

> Can I also detect the presence of certain files on his hard disk?

Not unless the users have some kind of plug-in installed which lets
this happen, or you exploit some security hole in their browsers. :-)

Certainly, if you want to transparently access files on the users'
disks then I think you will be disappointed.

Paul



More information about the Python-list mailing list