Forum Moderators: coopster

Message Too Old, No Replies

Problem uploading images - MSIE(Win) only

everything turns black

         

dcrombie

2:02 pm on Oct 10, 2005 (gmt 0)



We have a number of sites where clients can upload images via PHP. On just one site the uploaded jpegs are appearing as solid black rectangles - but only when using Explorer on Windows. The system in question doesn't resize or modify the images in any way, they're simply copied and renamed.

I can do the upload using Safari which works fine, download the new image from the site and then re-upload using IE6 and the image turns black.

Anyone seen anything like this?!?

StupidScript

9:08 pm on Oct 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yikes ... I haven't seen anything like that, but maybe the headers are getting mangled by IE? Maybe it's a default security setting in that browser? Is it consistent across different operating systems, or only on a Windows? You're using Safari on Windows?!?

RonPK

10:05 pm on Oct 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Very wild guess: many weird problems in IE/Win are due to a fully filled cache. What happens when you delete all 'temporary internet files'?

dcrombie

11:25 am on Oct 11, 2005 (gmt 0)



Thanks for the tips. I've done some debugging and narrowed it down to the following:

When uploading through Safari (Mac) the $_FILES array shows:

type => image/jpeg 
error => 0
size => 28125

but through MSIE6 (Win) I get:

type => image/pjpeg 
error => 0
size => 28125

Now, is that an indication that the image itself was created as a 'progressive' JPEG and that creating the image a different way would avoid the problem?

dcrombie

11:59 am on Oct 11, 2005 (gmt 0)



I might have solved it now.

Replaced:

if($_FILES[$this->tagname]['type']!= 'image/jpeg'

with:

if(!preg_match("/image\/p?jpeg/", $_FILES[$this->tagname]['type'])

elsewhere in the code.

Some references for anyone following:

[webmasterworld.com...]

;)

[edited by: coopster at 1:30 pm (utc) on Oct. 11, 2005]
[edit reason] removed url per TOS [webmasterworld.com] [/edit]

StupidScript

6:03 pm on Oct 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well done! ;)