Click here to Skip to main content
15,888,158 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a problem for download a file from a URL, via VB6. The link is like this. All of the server, are similar:

https://www.inforis.org/nuevo_ris/download_file.php?token=54cf5c32931c08ee9c03cd01ab5ea156&id=7394

I can download it using simple Inet Download function, but can´t get de filename. The server gives me only this Headers of the file:

HTTP/1.1 200 OK
Date: Tue, 15 Jan 2013 19:14:23 GMT
Server: Apache/2.2.16 (Debian)
Last-Modified: Wed, 09 Jan 2013 22:59:15 GMT
Etag: "400ae-1bd39a-4d2e302e7d6c0"
Accept-Ranges: bytes
Content-Length: 1823642
Keep-Alive: timeout=15, max=99
Connection: Keep-Alive
Content-Type: application/pgp-signature

But no the name, or the Location
Can anyone help me, please?

Thanks
Posted
Comments
Sergey Alexandrovich Kryukov 15-Jan-13 15:31pm    
Why do you think you need such a name?
—SA
Master.Man1980 15-Jan-13 16:00pm    
Sir.I can't find you from http://www.codeproject.com/script/Membership/Profiles.aspx. Where you @?
Master.Man1980 15-Jan-13 17:03pm    
It's a codeproject who's who page(Codeproject>Community>Who's who). You are not shown there. Something must be wrong
[no name] 15-Jan-13 17:09pm    
Search jonxvel. I am there....here! Alive!

1 solution

The URL and related content you receive via HTTP response is not associated with any particular file name. The resources obtained on the client side via the HTTP protocol do not have to be mapped on any file system. You can use any valid file name you like.

[EDIT]

As to the HTTP header "Location", please read:
http://en.wikipedia.org/wiki/HTTP_location[^],
http://tools.ietf.org/html/rfc2616[^].

It may or may not be there. Please see also my comments below.

—SA
 
Share this answer
 
v3
Comments
[no name] 15-Jan-13 15:38pm    
I know that. But the file of the server has a name!!. This name is necesary for the person who download the file. I used Firebug plugin in Firefox to get the headers and give me all the headers. Why i can get this header with Inet:

Log from Firebug:

https://www.inforis.org/nuevo_ris/download_file.php?token=54cf5c32931c08ee9c03cd01ab5ea156&id=7394

GET /nuevo_ris/download_file.php?token=54cf5c32931c08ee9c03cd01ab5ea156&id=7394 HTTP/1.1
Host: www.inforis.org
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:18.0) Gecko/20100101 Firefox/18.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Cookie: RIS_Autent_Token=Y1GYR1IW2SN24XX4L973
Proxy-Authorization: Basic am9uYXMudmVuZXJvOm5ocmd1M3g2cQ==
Connection: keep-alive

HTTP/1.1 302 Found
Date: Tue, 15 Jan 2013 19:14:23 GMT
Server: Apache/2.2.16 (Debian)
Accept-Ranges: bytes
X-Powered-By: PHP/5.3.3-7+squeeze14
Set-Cookie: RIS_Autorizado=si; expires=Tue, 15-Jan-2013 19:44:23 GMT; path=/download/confer/; domain=.inforis.org; secure
Location: https://www.inforis.org/download/confer/SPX_20130108_RELATO1792.PDF.PGP
Content-Length: 0
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/html
----------------------------------------------------------
https://www.inforis.org/download/confer/SPX_20130108_RELATO1792.PDF.PGP

GET /download/confer/SPX_20130108_RELATO1792.PDF.PGP HTTP/1.1
Host: www.inforis.org
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:18.0) Gecko/20100101 Firefox/18.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Cookie: RIS_Autorizado=si
Proxy-Authorization: Basic am9uYXMudmVuZXJvOm5ocmd1M3g2cQ==
Connection: keep-alive

HTTP/1.1 200 OK
Date: Tue, 15 Jan 2013 19:14:23 GMT
Server: Apache/2.2.16 (Debian)
Last-Modified: Wed, 09 Jan 2013 22:59:15 GMT
Etag: "400ae-1bd39a-4d2e302e7d6c0"
Accept-Ranges: bytes
Content-Length: 1823642
Keep-Alive: timeout=15, max=99
Connection: Keep-Alive
Content-Type: application/pgp-signature
----------------------------------------------------------
Sergey Alexandrovich Kryukov 15-Jan-13 15:48pm    
It may have a name, so what?

The resource may or may not have the name and correspond to a point of the file system of the host executing HTTP server. Such mapping or even one-to-one correspondence may exist, but it does not have to, for a very, very good reason. That's why you cannot see a file name in your headers. HTTP is fully free from mapping between URLs and server-side file names. The client side application should not rely on any assumptions on such mapping. Again, this is done for good, not for evil.

Just reconcile yourself with that fact, that's all you can do.

—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900