Re: [PHP] Upload file on IE8

2010-01-25 Thread Ashley Sheridan
On Mon, 2010-01-25 at 17:41 -0500, Ernie Kemp wrote:

 
 
 Good Day,
 
  
 
 I’m having an issue with IE8, when I go to load a file
 the program is not filling the $_FILES['user_file']['type']  .
 
 
   When I display  “echo  Start.$_FILES['pix']['type'].End;”  
 in IE8 I get “StartEnd” with nothing in between.  I expected “image/pjpeg.
  
 On FireFox I get “image/jpeg.
  
 Any suggestions?
 Thanks,
 /Ernie
  
 
 
  

What do the other $_FILES fields say? Are they populated correctly?

I wouldn't rely on anything sent from the browser. IE is known to send
the mime type that matches the extension, not the contents of the file,
and for .jpg images it sends a different mime to every other browser
anyway, so it's pretty unreliable.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Upload file on IE8

2010-01-25 Thread Eric Lee
On Tue, Jan 26, 2010 at 6:41 AM, Ernie Kemp ernie.k...@sympatico.ca wrote:

   Good Day,



 I’m having an issue with IE8, when I go to load a file the
 program is not filling the $_FILES['user_file']['type']  .

   When I display  “echo  Start.$_FILES['pix']['type'].End;”  
 in IE8 I get “StartEnd” with nothing in between.  I expected “image/pjpeg.



 On FireFox I get “image/jpeg.



 Any suggestions?

 Thanks,

 /Ernie



  I remember a setting from some elsewhere IE 8 was disable set file path
 location
 by default from the options dialog. Did you enabled this already ? If not,
 you may give it a shoot to see than !


 Hope this help


 Eric,
 Regards,









Re: [PHP] Upload file on IE8

2010-01-25 Thread Ashley Sheridan
On Tue, 2010-01-26 at 07:33 +0800, Eric Lee wrote:

 On Tue, Jan 26, 2010 at 6:41 AM, Ernie Kemp ernie.k...@sympatico.ca wrote:
 
Good Day,
 
 
 
  I’m having an issue with IE8, when I go to load a file the
  program is not filling the $_FILES['user_file']['type']  .
 
When I display  “echo  Start.$_FILES['pix']['type'].End;” 
   in IE8 I get “StartEnd” with nothing in between.  I expected “image/pjpeg.
 
 
 
  On FireFox I get “image/jpeg.
 
 
 
  Any suggestions?
 
  Thanks,
 
  /Ernie
 
 
 
   I remember a setting from some elsewhere IE 8 was disable set file path
  location
  by default from the options dialog. Did you enabled this already ? If not,
  you may give it a shoot to see than !
 
 
  Hope this help
 
 
  Eric,
  Regards,
 
 
 
 
 
 
 


But you won't be able to guarantee every IE8 user will do this, so you
shouldn't develop the app in such a way that it needs to use the value
in the array. Also, as I've said, there isn't much point relying on this
value for any reason anyway, as it doesn't guarantee the file is
actually of that type.

Thanks,
Ash
http://www.ashleysheridan.co.uk




RE: [PHP] Upload file on IE8

2010-01-25 Thread Ernie Kemp
 

 

 

 

From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
Sent: January-25-10 5:53 PM
To: Ernie Kemp
Cc: 'PHP General List'
Subject: Re: [PHP] Upload file on IE8

 

On Mon, 2010-01-25 at 17:41 -0500, Ernie Kemp wrote:



 

Good Day,

 

I’m having an issue with IE8, when I go to load a file the 
program is not filling the $_FILES['user_file']['type']  .

 
  When I display  “echo  Start.$_FILES['pix']['type'].End;”  in 
IE8 I get “StartEnd” with nothing in between.  I expected “image/pjpeg.
 
On FireFox I get “image/jpeg.
 
Any suggestions?
Thanks,
/Ernie
 

 

What do the other $_FILES fields say? Are they populated correctly?

I wouldn't rely on anything sent from the browser. IE is known to send the mime 
type that matches the extension, not the contents of the file, and for .jpg 
images it sends a different mime to every other browser anyway, so it's pretty 
unreliable. 


Thanks,
Ash
http://www.ashleysheridan.co.uk





With IE8,

  Using $_FILES the array results for  ‘name’ has the name of the file but 
‘type’, ‘tmp_name’ and ‘size’ are blanks.

 I tried enabling the “file path location” in IE8 option but the results 
are the same for $_FILES. 

 


   Firefox works displays all the values in the $_FILES array.

There must be a better way. Suggestions?

Thanks,

/Ernie



RE: [PHP] Upload file on IE8

2010-01-25 Thread Ashley Sheridan
On Mon, 2010-01-25 at 19:21 -0500, Ernie Kemp wrote:

 
 
 
 
 
 
 
 From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
 Sent: January-25-10 5:53 PM
 To: Ernie Kemp
 Cc: 'PHP General List'
 Subject: Re: [PHP] Upload file on IE8
 
  
 
 On Mon, 2010-01-25 at 17:41 -0500, Ernie Kemp wrote:
 
 
 
  
 
 Good Day,
 
  
 
 I’m having an issue with IE8, when I go to load a file the 
 program is not filling the $_FILES['user_file']['type']  .
 
  
   When I display  “echo  Start.$_FILES['pix']['type'].End;”  
 in IE8 I get “StartEnd” with nothing in between.  I expected “image/pjpeg.
  
 On FireFox I get “image/jpeg.
  
 Any suggestions?
 Thanks,
 /Ernie
  
 
 
 
 What do the other $_FILES fields say? Are they populated correctly?
 
 I wouldn't rely on anything sent from the browser. IE is known to send the 
 mime type that matches the extension, not the contents of the file, and for 
 .jpg images it sends a different mime to every other browser anyway, so it's 
 pretty unreliable. 
 
 
 Thanks,
 Ash
 http://www.ashleysheridan.co.uk
 
 
 
 
 
 With IE8,
 
   Using $_FILES the array results for  ‘name’ has the name of the file 
 but ‘type’, ‘tmp_name’ and ‘size’ are blanks.
 
  I tried enabling the “file path location” in IE8 option but the results 
 are the same for $_FILES. 
 
  
 
 
Firefox works displays all the values in the $_FILES array.
 
 There must be a better way. Suggestions?
 
 Thanks,
 
 /Ernie
 


Don't use the value. There are a few different ways in PHP to get the
mime type of a file, which it does based on the contents of the file and
not its extension. This prevents someone from uploading an executable
virus for example by just changing the last three letters of the
filename.

Have a look at fileinfo() for this sort of thing.

Thanks,
Ash
http://www.ashleysheridan.co.uk