473,804 Members | 2,116 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5092
Ø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
2147
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" ); header( "Content-Disposition: attachment; filename=\"$file\"\n" ); header( "Content-Transfer-Encoding: binary\n" ); header( "Content-Length: " . filesize($path.$file) . "\n" );
2
3488
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 (client-side) using JAVASCRIPT and write this value into a textfile in the server using PHP script. No problem so far. I call my PHP script using JAVASCRIPT (myPage.HTML):
4
3027
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
1951
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 well as projects. Recently I have been using a lot of Macromedia Flash Movies within my asp.net pages, as many people have. For those familiar with Flash macromedia can publish the html output for you so you only need to copy/paste to your...
1
1769
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 download does not start in 10 sec. please click the link below". At this point I would like to attempt to download the file and send it to the client. One think I managed to do is to call a "DownloadBridge.aspx" page from the Body's onload event and...
13
3328
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 visitor fills out the form and submits it, this calls a rather ordinary asp script like formmail.asp that sends the emails and displays a "thank you" web page. At the very end of my "thank you" web page I placed the following: <script...
2
2566
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 site. The tracking code must be sent to the client when the user clicks the download button. At the same time, the download must start. The download button links to this page: - Possibility 1, server side redirect to executable...
7
3442
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 of downloads of this file on my website, IP address and date. Since I have no access to Apache log files, I need some other way, use script that will write a log file. Is there some handy way? M.
2
1825
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 suggestions appreciated.
1
47495
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 on a link and after a moment or two a file download dialog box pops-up in your web browser and prompts you for some instructions, such as “open” or “save“. I’m going to show you how to do that using a perl script. What You Need Any recent...
0
9716
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10604
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10354
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10359
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10101
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6870
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5536
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5675
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4314
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.