I need to download a file from a url which has format similar to http://server.com/settings/files/1
when I paste this url in a web-browser this can determine the name of the file to download in this case scheme_563.txt
, my question is how I can retrieve the name of the file (which obviously is not included in the url) to download using the wininet functions? currently i am using the HttpQueryInfo
function with multiples values like HTTP_QUERY_CONTENT_LOCATION,HTTP_QUERY_CONTENT_DESCRIPTION, etc. but without luck.
Method 1: You can use Wait for Download activity to download a file, then you can use Rename activity to rename it. Method 2: To rename a file before downloading, you can use Http request to download and name the file. You can configure download file name in “Download Resource”.
If you download a file using google chrome you can see its by using shortcut Ctrl+J or directly go to your downloads and under every download there is its original download URL. If you can't see the complete URL then you can right click on that URL and Copy Link. How do I use a URL?
Click on the "Edit Menu" > Preferences > General tab. Locate the "Save downloaded files to" section, Click on "Downloads" > "Other"... Browse and indicate your new download location.
According to http://en.wikipedia.org/wiki/List_of_HTTP_header_fields, the Content-Disposition header includes this information
Content-Disposition: attachment; filename=fname.ext
Maybe this optional header is available in the response to a HTTP GET or HEAD request in this case.
Note that the filename may be encoded - see How to encode the filename parameter of Content-Disposition header in HTTP? for a discussion
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With