473,324 Members | 2,541 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Implement file download using python

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.

Thanks,
Salil .

Sep 27 '07 #1
2 2155
sk*****@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
Sep 27 '07 #2
On Sep 27, 11:39 am, "Diez B. Roggisch" <de...@nospam.web.dewrote:
skul...@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
Thanks Diez for your reply.
I am comfortable with using ftplib to fetch the file. As for the HTTP-
server environment,
I am using Apache 1.3 web server and python 2.1.3.

Salil.

Salil.

Sep 27 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Prabu | last post by:
Hi, I'm new to python, so excuse me if i'm asking something dumb. Does python provide a mechanism to implement virtual functions? Can you please give a code snippet also...:) Thanx in advance...
8
by: Radioactive Man | last post by:
I am fairly new to the latest verion of Python and using it on windows 95, 2000, and/or XP. What libraries, modules, functions, etc. would I need to set up a Python script to download a file, say...
1
by: Slackydude | last post by:
Hi, i'm trying to make a download manager (getright, flashget, etc..) for linux (pygtk), i'm using pyCurl, so the thing is.. the app need to be able to use mirrors, like : i download the first 400...
5
by: John Devlon | last post by:
Hi, Some people like to go on vacation during christmas time, others try to do something they never did before.... I would like to create a multiple file upload page, with some nice progress...
1
by: lPrentice | last post by:
Hello, After all this time, Linux file permissions still confuse me at times. I have a Python web-based application with an file (images) upload module. The application is running on two remote...
18
by: W. Watson | last post by:
See Subject. It's a simple txt file, each line is a Python stmt, but I need up to four digits added to each line with a space between the number field and the text. Perhaps someone has already done...
2
by: John Salerno | last post by:
Is the chm doc file available for download from the Python website? I can't seem to find it. It would be nice to read through while I'm at work (where I don't have Python installed). Also, is it...
15
by: patf | last post by:
Hi - experienced programmer but this is my first Python program. This URL will retrieve an excel spreadsheet containing (that day's) msci stock index returns. ...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.