[RESOLVED] The filename of this image
Hi all,
I am trying to accomplish something with a C# program (don't scream I know this is the PHP forum :))
Have a look at this picture: http://www.celeb-city.de/forum/attac...3&d=1135040449
A lovely lass indeed...
The problem I am running into is getting the filename for the image, when you save it with your browser it seems to automatically know the filename. I have looked in the headers, but the Content-Location header is not provided.
The reason I ask it here is because PHP developers are the ones sending out these images and looking at it from the other side this might be a no-brainer for you all. :D
I am stuck it seems. :(
(brainstorming is OK too)
Re: The filename of this image
What are you trying to do with your C# program? You can send the filename along with the file when it is uploaded in the HTTP request. Have a look in my signature at the winsock file upload to see how it's consturcted.
Re: The filename of this image
No actually downloading it, I am trying to figure out how my browser magically knows its filename when I rightclick->save.
It couldn't be inbedded in the image right? Hopefully that's not it, I'm hoping the info is in the response somehow.
Re: The filename of this image
These are all the headers I am getting, the Content-Disposition - wich you are using to indicate the filename in your program - is not given.
Code:
Transfer-Encoding
chunked
Content-Type
text/html; charset=ISO-8859-1 (it doesn't even say it's an image??)
Date
Tue, 20 Dec 2005 17:20:53 GMT
Server
Apache/2.0.48 (Linux/SuSE)
Thank you for your attention :wave:
Re: The filename of this image
The file name is contained in the HTTP response from the server in the Content-Disposition header. This for example is the HTTP response sent when I download an attachment from the Chit Chat forum.
Code:
HTTP/1.1 200 OK
Date: Tue, 20 Dec 2005 17:16:55 GMT
Server: Apache
Cache-control: max-age=31536000
Expires: Wed, 20 Dec 2006 17:17:03 GMT
Last-Modified: Tue, 20 Dec 2005 13:19:28 GMT
ETag: "43685"
Content-disposition: attachment; filename="2 words story.txt"
Content-Length: 27963
Connection: close
Content-Type: plain/text
Re: The filename of this image
In the case of an image, remember, the image is downloaded separatley and it will contain a header such as:
Code:
Content-Type: image/gif
Content-disposition: inline; filename=avatar_wild.gif
Note the Content-Type, it will be image/jpeg or image/gif if it is an image. If its text/html it will be a web page.
Re: The filename of this image
lol yes, I tested that same file and got this:
Code:
Date
Tue, 20 Dec 2005 17:21:52 GMT
Set-Cookie
RMID=54519c9643a83db0; expires=Fri, 31-Dec-2010 23:59:59 GMT; path=/; domain=.vbforums.com,bbsessionhash=97f327aba51b6c13cb48075bb3a67a7b; path=/; domain=.vbforums.com,bblastvisit=1135099312; expires=Wed, 20-Dec-06 17:21:52 GMT; path=/; domain=.vbforums.com,bblastactivity=1135099312; expires=Wed, 20-Dec-06 17:21:52 GMT; path=/; domain=.vbforums.com
Server
Apache
X-Powered-By
Cache-control
max-age=31536000
Expires
Wed, 20 Dec 2006 17:21:52 GMT
Last-Modified
Tue, 20 Dec 2005 13:19:28 GMT
ETag
"43685"
Content-disposition
attachment; filename="2 words story.txt"
Content-Length
27963
Keep-Alive
timeout=15, max=100
Connection
Keep-Alive
attachment; filename="2 words story.txt"
Indeed it has the disposition header, but the image in this case does not, yet my browser somehow knows it. :confused:
Re: The filename of this image
Whatever it is you are trying to get, it is not an image. Maybe it has something to do with the fact you need to be logged into to view the page. ;)
Re: The filename of this image
Quote:
Originally Posted by visualAd
Whatever it is you are trying to get, it is not an image. Maybe it has something to do with the fact you need to be logged into to view the page. ;)
Are you saying you cannot see it? Because the link works when I am not logged in.
Quote:
Originally Posted by visualAd
In the case of an image, remember, the image is downloaded separatley and it will contain a header such as:
Code:
Content-Type: image/gif
Content-disposition: inline; filename=avatar_wild.gif
Note the Content-Type, it will be image/jpeg or image/gif if it is an image. If its text/html it will be a web page.
How do you mean seperately?
Re: The filename of this image
Wait a minute, it does matter, IE didn't load it either. :blush:
I have run into this problem before, this link may be a bad example. But I guess I have my answer now: Content-Disposition.
Thanks :thumb:
Re: [RESOLVED] The filename of this image
The link gives me a login page. I didn't look at it until just now.
Re: [RESOLVED] The filename of this image
Quote:
Originally Posted by visualAd
The link gives me a login page. I didn't look at it until just now.
I should have double checked before posting, sorry.