RE: [PHP] jpeg photo file upload problem

This is a discussion on RE: [PHP] jpeg photo file upload problem within the PHP General forums, part of the PHP Programming Forums category; You're exactly right. I did a test on a win box and it reported image/pjpeg I ran tests ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-18-2003
John T. Beresford
 
Posts: n/a
Default 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
Reply With Quote
  #2 (permalink)  
Old 07-21-2003
Motorpsychkill
 
Posts: n/a
Default RE: [PHP] jpeg photo file upload problem

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
>


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 01:25 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0