How can I download file name from URL ?
Like if I have URL like http://localhost/?downloadFile=56
and server will return file example.png
. Because when I try to use
WebClient wc = new WebClient();
wc.DownloadFileAsync(url, "{FILE-NAME}");
I having problem to get the file name automatically.
Browsers will use the contents of the filename
parameter of the Content-Disposition
header as the default filename. If such a header is not available, browsers will typically use a generated filename based on the final component of the URL's path component.
See some additional information here: http://blogs.msdn.com/b/ieinternals/archive/2010/06/07/content-disposition-attachment-and-international-unicode-characters.aspx
I'd think you'd have to download the file and then get the file name from the downloaded file. Not sure how this is a programming question though.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.