cURL / Mailing Lists / curl-library / Single Mail


Re: How to get the original filename of a downloading file.

From: Craig Davison <>
Date: Thu, 10 Oct 2002 10:51:38 -0600

On Thu, Oct 10, 2002 at 07:16:12PM +0800, ?? ?? wrote:
> I know there's no original filename associated with a URL. But if a URI
> is directly linked to a file, such as
> We know it is a zip file and named
> as "". But bucause jsp and asp use middle ware, the middle
> layer server receives our request and gets a file from other place differ
> from the original URL such as "". My
> question is , how to get the filename when the stream arrives. Thanks.

You might want to build a table of MIME types and file extensions somewhere in your application. That way, if /request01.jsp returns a MIME type of application/zip, you'll know to save it as Similarly, if it returned image/gif, you would save request01.gif.

Craig Davison
Symantec Corporation
+1 (403) 213-3939 ext. 228
This email is sponsored by:ThinkGeek
Welcome to geek heaven.
Received on 2002-10-10