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

**URL:** <https://forum.kirupa.com/t/php-binary-jpeg-post-dl-as-octet-ok-how-should-you-display-inline-for-save/212662>\
**Category:** programming\
**Created:** [January 12, 2007, 9:57pm UTC](https://forum.kirupa.com/t/php-binary-jpeg-post-dl-as-octet-ok-how-should-you-display-inline-for-save/212662 "2007-01-12T21:57:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [January 12, 2007, 9:57pm UTC](https://forum.kirupa.com/t/php-binary-jpeg-post-dl-as-octet-ok-how-should-you-display-inline-for-save/212662/1 "2007-01-12T21:57:47Z")

</div>

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
