Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.

Cheers,
Kirupa

Results 1 to 3 of 3

Thread: [PHP] Binary JPEG POST; DL as octet: OK. How should you display inline for save?

  1. #1

    [PHP] Binary JPEG POST; DL as octet: OK. How should you display inline for save?

    I have a post coming into a PHP page that is a JPEG image. Right now I'm reading 'php://input' with fopen and fread and printing the contents using headers of (basically):
    'Content-Type: application/octet-stream'
    'Content-Disposition: attachment; filename=image.jpg'

    This works. The image downloads and you can see it just fine. However, I was trying to get the image to be viewed inline within the browser. I was doing that apparently fine using a header of:
    'Content-Type: image/jpeg'

    However, if you try to save the image, it doesn't work. What happens is (I think) the page is re-called for the download sans POST data and my "there is no image" error message gets thrown in in place of the JPEG content - again, I think.

    Either way, is there any way to get that to work right (other than a temp file created on the server)?

    Thanks

  2. #2
    i don't know of a way to do it without creating a temp jpeg. i've been playing with it (for the kirupa footer contest actually) and will continue to do so. i'll repost if i come across anything.

  3. #3
    Cool, thanks. I think currently my plan is just jump straight to the download. If I want a HTML page to display the picture as well as be downloadable, I'll probably do the temp file thing.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012