• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 144
  • Last Modified:

How to specify the download file name on the download frame

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
Huangjin
Asked:
Huangjin
  • 2
  • 2
1 Solution
 
bigbedCommented:
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
 
maneshrCommented:
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
 
bigbedCommented:
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
 
maneshrCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now