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.
            Asked
            
        
        
            Active
            
        
            Viewed 919 times
        
    5
            
            
        1 Answers
6
            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
 
     
    