Solved

How to specify the download file name on the download frame

Posted on 2000-05-10
4
132 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 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

If you get a (Blue Screen of Death), your system writes a small file called a minidump. Your first step is to make certain your computer is setup to record memory dumps. Right click My Computer, choose properties. Click on the advanced tab, an…
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…
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 …

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now