curl-library
Re: How to get the original filename of a downloading file.
Date: 10 Oct 2002 15:09:22 +0200
Hi!
> 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.
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.)
-
Bence
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2002-10-10