Solved

CGI question

Posted on 1997-06-05
1
186 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

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

Introduction This tutorial will give you a fast look what you can do with WhizBase. I expect you already know how to work with HTML at least, and that you understand the basics of the internet and how the internet works. WhizBase is a server-s…
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.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

688 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