RE: [PHP] jpeg photo file upload problem
| From: | motorpsychkill | Date: | Mon, 21 Jul 2003 17:17:44 +0000 |
| Subject: | RE: [PHP] jpeg photo file upload problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-156092@lists.php.net to get a copy of this message | ||
You may want to try getimagesize(), as this is more consistent in
determining mime types. That is what I wound up doing as it appears to
override the browser/platform idiosyncracies.
-m
> -----Original Message-----
> From: John T. Beresford [mailto:john-nic@beresford.net]
> Sent: Thursday, July 17, 2003 5:51 PM
> To: motorpsychkill; php-general@lists.php.net
> Subject: RE: [PHP] jpeg photo file upload problem
>
>
>
> You're exactly right.
>
> I did a test on a win box and it reported image/pjpeg
> I ran tests on other browsers/platforms, and for a .jpg image, only a
> handful of win boxes reported the 'pjpeg' thing.
>
> I also did tests using 'regular jpegs' and 'progressive jpegs' and
> that had no effect.
>
> Apparently the ms browser on a win box calls a 'jpeg a 'pjpeg'
>
> Anyway, to all, thanks for all the help, it's all working now.
>
> John
>
>
> At 5:43 PM -0700 7/17/03, motorpsychkill wrote:
> >I suspect this may be a browser/platform issue. I've recently run some
> >tests and below are the most interesting results (mime types):
> >
> >IE 6 on PC:
> >something.jpg -> image/pjpeg
> >something.tif (pc format) -> application/octet-stream
> >something.tif (mac format) -> image/tiff
> >
> >IE 5 on Mac:
> >something.bmp -> application/octet-stream
> >something.jpg -> image/jpeg
> >
> >
> >NS 4.7 on Mac:
> >something.bmp -> image/x-MS-bmp
> >
> >Opera 7 on PC:
> >something.bmp -> image/x-windows-bmp
> >
> >I suspect if you want to validate jpgs, use image/jpeg and image/pjpeg or
> >validate by examining the extention (ie ".jpg"). I don't know
> how safe the
> >latter is.
> >
> >HTH,
> >
> >m
> >
> >
> >> -----Original Message-----
> >> From: John T. Beresford [mailto:john-nic@beresford.net]
> >> Sent: Wednesday, July 16, 2003 7:49 PM
> >> To: php-general@lists.php.net
> >> Subject: [PHP] jpeg photo file upload problem
> >>
> >>
> >> Hi All,
> >>
> >> I have a system that allows a person to upload photos to the server
> >> via an admin web form.
> >>
> >> I have been using the code for about a year with no problem. I
> >> designed it specifically for a client of mine that has just started
> >> cruising on a sailboat for a few years.
> >>
> >> They tryed uploading a photo from a public library via the web form
> >> and they got the error message that it was not a jpeg file.
> >>
> >> The relevent PHP code from my system for the checking is:
> >>
> >> if ($type != "image/jpeg") {
> >> $ReturnSaying = "!! The file is not a JPEG picture. Please try again";
> >> include("photo_error.php");
> >> exit;
> >>
> >> Anyway, this system has been tested and tested again on multiple
> >> platforms and conditions, except a public library.
> >>
> >> Question: Is it possible that the library is using some proxy system
> >> that is messing with the file so it comes out bad?
> >>
> >> Also, I have confirmed that the file is a jpeg file.
> >>
> >> Any ideas are greatly appreciated,
> >> John
> >>
> >> --
> >> ===========================
> >> John T. Beresford, Owner
> >> Digital Studio Design
> >> Edmond, OK
> >> http://www.digitalstudiodesign.com/
> >> 405.760.0794
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> ===========================
> John T. Beresford, Owner
> Digital Studio Design
> Edmond, OK
> http://www.digitalstudiodesign.com/
> 405.760.0794
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>