Implement file download using python

Diez B. Roggisch deets at nospam.web.de
Thu Sep 27 12:39:24 EDT 2007


 skulka3 at gmail.com wrote:

> Hello,
> 
> I want to implement file downloads inside an authenticated web page,
> such that when a user clicks a link, the server side python code
> connects to a ftp server, downloads a relevant file and then streams
> the file to the browser for the user to open it with the appropriate
> application. In this case it will either be a pdf or a tiff file.
> 
> This function is quite similar to something like writing raw bytes to
> a ServletOutputStream in java to be rendered directly to the user.
> 
> It would be nice if someone can provide guidance, examples on how such
> a task may be accomplished using python.

Fetching using ftplib is easy. But serving depends on what
HTTP-server-environment you use. Please elaborate on that.

Diez



More information about the Python-list mailing list