Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to specify the download file name on the download frame

Posted on 2000-05-10
4
Medium Priority
?
140 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
  • 2
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
bigbed earned 800 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

This tutorial will discuss the log-in process using WhizBase. In this article I assume you already know HTML. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you might look at some of my other articles abo…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

972 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