[python-win32] Re: Download a file from FTP server to local machine

Tim Roberts timr at probo.com
Mon Feb 7 20:16:48 CET 2005


On Sun, 6 Feb 2005 16:41:26 +0000 (GMT), rozita raissi 
<rvm_1380 at yahoo.com> wrote::

> 
>I'm writing an ftp client script which must run in explorer. My script must be placed on and run from a web server. User can connect through it to a FTP server. If user requests to download a file from FTP server, file is downloaded to web server on which my script is running. How can I transfere downloaded file from web server to client local machine?
>

So, basically, you want an FTP-to-HTTP gateway?  A CGI script which 
fetches from an FTP site and relays it to the user?  That isn't hard at 
all.  Just define the Content-Type appropriately (application/binary if 
nothing else) and copy the fetched file to the script's stdout.

But as an alternative, I would think it would be easier just to redirect 
to the FTP site and let IE do the download:

    print "Refresh: 0;URL=ftp://myftp.mysite.com/dir1/dir2/myfile.txt"

-- 
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-win32 mailing list