Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Change default filename when downloading from cgi

Posted on 1999-07-06
Medium Priority
Last Modified: 2013-12-25

I am using a cgi script (perl with windows nt) to send file to client browser (download fonction).

The problem is : when the window open (save as), the default name of the file is the name of the cgi program.

how can i change the default name before the "save as" window open ??

I use this code to send the file :

 print "HTTP/1.0 302 Found\n";
 print "Content-type: multipart/x-zip\n\n";
 binmode STDOUT;
 open (FILE, $file);
 read (FILE, $buffer, -s $file);
 print $buffer;


Question by:didede
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
LVL 75

Accepted Solution

Michel Plungjan earned 300 total points
ID: 1834916
1. Use the path info method:
so myplprogram is the executable and / will be accessible to your program in the path-info environment variable.
This works for most browsers...

2. Use the HTTP header
Content-disposition: inline;

No special chars allowed in the filename...

LVL 75

Expert Comment

by:Michel Plungjan
ID: 1834917
PS: the filename may have to be in quotes:
Content-disposition: inline; filename=""

and you might want to use this too:
Content-type: multipart/x-zip; name=""


Featured Post

Major Serverless Shift

Comparison of major players like AWS, Microsoft Azure, IBM Bluemix, and Google Cloud Platform

Question has a verified solution.

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

This article will show, step by step, how to integrate R code into a R Sweave document
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…

715 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