Solved

How to specify the download file name on the download frame

Posted on 2000-05-10
4
137 Views
Last Modified: 2013-12-25
When I down load the data from the DB  by using CGI, the file name displayed on frame of file download is of my running file's name(for example: dbdload.pl). I wont to give to clients the file name like "data_xx.csv" on frame of file download directly, even through the file doesn't exist at that time, but I don't know how to do it.
0
Comment
Question by:Huangjin
[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
  • 2
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
bigbed earned 200 total points
ID: 2796469
In the headers which you output, you could try putting the following:
print "Content-type: application/octet-stream\n";
print "Content-disposition: filename='data_xx.csv'\n\n";

though I don't think all browsers are consistent in handling it (especially IE)

Does this help?
0
 
LVL 16

Expert Comment

by:maneshr
ID: 2797444
what web server are you running?

for non IIS servers you can just append the filename to the URL and the download will then be on that filename. Unfortunately, IIS does not support this.

0
 
LVL 3

Expert Comment

by:bigbed
ID: 2799297
I like maneshr's idea.
Perhaps a combination of the two would help more browsers to understand the filename you want (assuming, as maneshr said, that you're not running IIS).
0
 
LVL 16

Expert Comment

by:maneshr
ID: 2800177
in fact i think bigbed's idea is the better of the two since you can use that on any web server.

i intend using it myself in the future!!

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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 will show, step by step, how to integrate R code into a R Sweave document
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

734 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