cURL / Mailing Lists / curl-library / Single Mail

curl-library

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

From: Craig Davison <cd_at_securityfocus.com>
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
> http://www.someserver.com/download.zip. We know it is a zip file and named
> as "download.zip". 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 "http://www.someserver.com/request01.jsp". My
> question is , how to get the filename when the stream arrives. Thanks.

Hi,
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 request01.zip. Similarly, if it returned image/gif, you would save request01.gif.

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