Solved

How to specify the download file name on the download frame

Posted on 2000-05-10
4
138 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
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.

635 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