Solved

CGI question

Posted on 1997-06-05
1
183 Views
Last Modified: 2013-12-25
I would like users to be able to download files from my web site, without showing them the URL of the file.  I can hide the URL in the HTML code, but the browser the user has will display the file's URL. With HTML files I provide my customers, I call an .asp script to write the file to the browser, thus hiding the html file name, but I haven't figured out how to do this when downloading files. I've looked at .asp methods as well as perl. Maybe there is some way to write the binary stream out to the browser! Thanks in advance if you can help.
0
Comment
Question by:ebuescher
1 Comment
 
LVL 5

Accepted Solution

by:
icd earned 50 total points
ID: 1828183
I would approach this by writing a script (in perl) that opens the file to download and outputs it to stdout, effectively this will output it to the browser.

The main issue will be that the browser will be expecting a particular mime type. Some types the browser will deal with itself, such as text or gif images. For those types that the browser does not know about it will prompt if the user wants to save the file. For example exe files are handled this way.

If it was an exe file that was being downloaded then you would output the following prior to outputting the exe file.

print "Content-type: application/octet-stream\n\n";

This would result in the user being prompted where to save the file to. Unfortunately you will also find that the default file name will be the name of the script, there is no way to change this default.

0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question