473,385 Members | 1,780 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,385 software developers and data experts.

Download to client from a cgi script?

Hi,

(This question may be stupid, but I just can't find the answer...)

How can I make the browser downlaod a cgi script from /cgi-bin/.
Obviously I can't make a link to it with <a=href="/cgi-bin/script.cgi>,
since tha script will be executed then.

I see how Lutz in PP2E prints the script on the screen, but I want the
user to get the "save file" message box?

Same thing. What about a binary file? Printing a binary file with
getfile.cgi from PP2E is just silly. The surfer must be promped to save.
So, what I want is a script like getfile.cgi, that downloads insted of
prints the file.
(Maybe this is more a HTTP/HTML question than a Python question...)

Clueless,
-Øystein

Jul 18 '05 #1
2 5068
Øystein Johansen <oy*****@gnubg.org> writes:
[...]
How can I make the browser downlaod a cgi script from
/cgi-bin/. Obviously I can't make a link to it with
<a=href="/cgi-bin/script.cgi>, since tha script will be executed then.

I see how Lutz in PP2E prints the script on the screen, but I want the
user to get the "save file" message box?
Don't put it in the cgi-bin? There will be other ways, too, all of
which are entirely dependent on your web server and its configuration.
Anything regarded by your server as a cgi-script *shouldn't* be
downloadable, because that would risk security problems. Some servers
will always regard anything ending in ".cgi" or ".py" or whatever as
CGI scripts, some will regard anything in a particular directory as
CGI scripts, some will do other things.

Same thing. What about a binary file? Printing a binary file with
getfile.cgi from PP2E is just silly. The surfer must be promped to
save. So, what I want is a script like getfile.cgi, that downloads
insted of prints the file.
I don't understand any of this paragraph.

(Maybe this is more a HTTP/HTML question than a Python question...)


None of the above: entirely a web server question.
John
Jul 18 '05 #2
If you want to trigger the browser to ask 'save this file?' then you
gotta pass it a Content-Type that will trigger that.

At the top of your cgi script, get rid of 'Content-Type: text/html\n\n'
and replace it with 'Content-Type: application/octet-stream' or
something like that.

This page:

http://ppewww.ph.gla.ac.uk/~flavell/...tent-type.html

describes some IE bugs. Good luck! If you figure it all out, can you
post a message back here for future reference?


On Sun, 21 Sep 2003 21:28:46 +0200
Øystein Johansen <oy*****@gnubg.org> wrote:
Hi,

(This question may be stupid, but I just can't find the answer...)

How can I make the browser downlaod a cgi script from /cgi-bin/.
Obviously I can't make a link to it with <a=href="/cgi-bin/script.cgi>,
since tha script will be executed then.

I see how Lutz in PP2E prints the script on the screen, but I want the
user to get the "save file" message box?

Same thing. What about a binary file? Printing a binary file with
getfile.cgi from PP2E is just silly. The surfer must be promped to save.
So, what I want is a script like getfile.cgi, that downloads insted of
prints the file.


(Maybe this is more a HTTP/HTML question than a Python question...)

Clueless,
-Øystein

--
http://mail.python.org/mailman/listinfo/python-list


Jul 18 '05 #3

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

Similar topics

2
by: Pedro Fonseca | last post by:
Greetings! In my PHP website I'm trying to raise a File Download dialog directly in a WindowsCE IE client with the following code: header( "Content-Type: application/octet-stream\n" );...
2
by: duane | last post by:
Dear Experts: I am trying to measure a HTML page download time on the client side and store the value into a textfile located in the server. I have successfully measured the page download time...
4
by: D. Alvarado | last post by:
Hello, I would like to design a page that measures the user's download connection. Does anyone have an example link or script that might aid me in this task? Thanks, - Dave
0
by: Ron Vecchi | last post by:
Hello, Through using this and many other Microsoft dotnet newsgroups I have been pointed towards many helpful open source projects and articles that have helped a great deal in my studies as...
1
by: Iulian | last post by:
Hi, I am working on a directory type of site and I got stuck in the following problem: when the user clicks on the download link I present a page that sais: "Contacting download site... If the...
13
by: bmurphy | last post by:
Last week after much searching, I found the answer to my problem in this newsgroup. I can't find the thread from which I got my solution, but I wanted to report back what worked. When the site...
2
by: Jan Paul van de Berg | last post by:
I have a piece of software that people can download and a third party promoting that software. In order for them to be able to count the number of downloads, I have to put a tracking code on my...
7
by: mistral | last post by:
I use htaccess to protect directory and granting access to download file only for the authorized users. Just want implement simple PHP file download counter for single file. I need track the number...
2
by: andrew.zahra | last post by:
Is there any way to track completion of a download with PHP? I would like to be able to check if a download completed successfully. My first thought is that I might need to use an applet? Any...
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.