View Full Version : Content-type: image/pjpeg - help :(

10-23-2008, 10:47 AM
hi all,

im aware of the problems with uploading jpegs with IE... they are all stored as pjpeg. i have searched google a lot - the problem is well documented but i cant find a solution to it!?!?

how can i stop this? the problem is that when saved back form the system they cannot be viewed by anything... even the MS image viewer thingy!

this is really annoying as progressive jpegs are rarely used anywhere!

my code for the download:

if(isset($_GET['id'])) {
// if id is set then get the file with the id from database

include 'config.php';
include 'opendb.php';
$id = $_GET['id'];
$query = "SELECT name, type, size, content FROM upload WHERE id = '$id'";

$result = mysql_query($query) or die('Error, query failed');
list($name, $type, $size, $content) = mysql_fetch_array($result);

if ($type == 'image/pjpeg') {
$type = 'image/jpeg';

header("Content-length: $size");
header("Content-type: $type");
header("Content-Disposition: attachment; filename=$name");
echo $content;

include 'closedb.php';

as you can see i even try to translate this for the download - no luck. i then try to adjust a file in the db to be image/jpeg and it still doesnt work!


10-24-2008, 09:20 AM
bump :(

supposed to be going live monday! eek!

10-24-2008, 06:20 PM
Are you sure the image has been inserted into the table properly?

10-27-2008, 10:06 AM
yup... all other files i upload work ok - just jpegs that have the problem....

normally people wouldnt store jpegs in there but sometimes they might

10-27-2008, 09:03 PM
The only thing you can do is determine if it's pjpeg and return back telling
the user that you don't allow pjpeg.

Progressive JPEG's are created on a user's PC (using some photo editors).
For those that don't know what they are ... in the days of mostly slow dial-up,
progressive JPEGs cause the whole image to appear in sort of a "fade-in" mode.
It looks better than a blank image filling from top to bottom.

They are no longer used much anymore ... most people now have hi-speed.

So, the creation of them is a part of Windows and photo editors.

If someone uses IRFan or Snag-It or something to edit or resize photos, they
save them as JPEG and they will be uploaded as JPEG even if they upload
using IE6 or IE7.

I use IE to upload JPEGs all the time and have never had any problems with it.

10-28-2008, 10:17 AM
seems to be any image file that is saved when i look more into it. including tiff and GIF?

hmmmmm - more digging i think!

10-28-2008, 03:34 PM
I wonder if this is a php config file issue with your server.
Not sure if they have a place to enable/disable pjpeg.

10-28-2008, 03:38 PM
its happening tho with GIG and TIFF also... not sure what is wrong...

im re doing it with filesystem over blobs anyway - its been too much of a pain in the backside! :(