Results 1 to 12 of 12

Thread: [RESOLVED] The filename of this image

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    May 2005
    Posts
    898

    Resolved [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.
    I am stuck it seems.

    (brainstorming is OK too)
    Last edited by grilkip; Dec 20th, 2005 at 07:21 AM.
    "so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman

  2. #2
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    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.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    May 2005
    Posts
    898

    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.
    "so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    May 2005
    Posts
    898

    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
    "so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman

  5. #5
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    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
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  6. #6
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    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.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    May 2005
    Posts
    898

    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.
    "so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman

  8. #8
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    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.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    May 2005
    Posts
    898

    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?
    "so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman

  10. #10

    Thread Starter
    Fanatic Member
    Join Date
    May 2005
    Posts
    898

    Re: The filename of this image

    Wait a minute, it does matter, IE didn't load it either.

    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
    "so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman

  11. #11
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: [RESOLVED] The filename of this image

    The link gives me a login page. I didn't look at it until just now.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  12. #12

    Thread Starter
    Fanatic Member
    Join Date
    May 2005
    Posts
    898

    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.
    "so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width