cURL / Mailing Lists / curl-library / Single Mail


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

From: Traxler Bence <>
Date: 10 Oct 2002 15:09:22 +0200


> 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.

Maybe you can find the filename in the HTTP header. Many scripts use
some kind of header like this to identify the file:

Content-Disposition: atachment; filename="name_of_the_real_file"
Content-Type: "content_type"
Content-Length: file_size
Pragma: no-cache
Expires: 0

Keep in mind, that not every browser can handle this. (For example Opera
can't but Explorer, Mozilla/Netscape, Konqueror, etc can.)


This email is sponsored by:ThinkGeek
Welcome to geek heaven.
Received on 2002-10-10