views:

33

answers:

2

It looks like it does not matter what image headers I use for spitting out via php script an image file with unknown extension, call it .ext

Are there any actual effects? (Is PHP silently converting it, or bypassing the format?)

+4  A: 

PHP is most certainly not silently converting anything. It's the browser trying its best to interpret what it got served. Most browsers are likely not even paying that much attention to either the Content-Type header or the extension and just try to identify the file by its content.

deceze
+1  A: 

Is the output you get the output you expect?

Maybe the script is outputting an error or the function you are using isn't binary safe, I'm guessing from your tags that you are using file_get_contents but what you may be looking for is fpassthru?

Try opening the file in your browser without setting headers or set a standard html/text header, see if something curious is happening.

Good luck.

Kristoffer S Hansen