Re: [PHP] Is there an alternative for $_FILES['guildimage']['type'] == image/jpeg

2005-11-26 Thread Andy Pieters
On Wednesday 23 November 2005 03:15, twistednetadmin wrote: I use this line in a script for uploading pictures to a website: $_FILES['guildimage']['type'] == image/jpeg [snip] Please understand that the type is set by the browser and is never to be trusted. Especially with file uploads,

Re: [PHP] Is there an alternative for $_FILES['guildimage']['type'] == image/jpeg

2005-11-23 Thread Curt Zirzow
On Wed, Nov 23, 2005 at 06:48:25AM +0100, twistednetadmin wrote: This did the trick: elseif ($_FILES['guildimage']['type'] == image/pjpeg or image/jpeg) Not for reasons you think. The (or image/jpeg) is going to evaulate as TRUE, so your expression will always be true. For example:

Re: [PHP] Is there an alternative for $_FILES['guildimage']['type'] == image/jpeg

2005-11-23 Thread Ben
Curt Zirzow wrote: You should really consider using the fileinfo extension, or mabey even http://php.net/getimagesize. The ['type'] information can't be trusted to be what it says it is. Any reason why no one is suggesting the use of mime_content_type? http://ca.php.net/mime_content_type

Re: [PHP] Is there an alternative for $_FILES['guildimage']['type'] == image/jpeg

2005-11-23 Thread Stephen Leaf
I'd say because it's been depreciated. LXXVI. Mimetype Functions Introduction Warning This extension has been deprecated as the PECL extension fileinfo provides the same functionality (and more) in a much cleaner way. On Wednesday 23 November 2005 12:45 pm, Ben wrote: Curt Zirzow wrote:

[PHP] Is there an alternative for $_FILES['guildimage']['type'] == image/jpeg

2005-11-22 Thread twistednetadmin
I use this line in a script for uploading pictures to a website: $_FILES['guildimage']['type'] == image/jpeg This works fine when using Mozilla, but it doesn't work with IE. How should I do it to get it working with both/all browsers? if (isset($_POST['submit']))

Re: [PHP] Is there an alternative for $_FILES['guildimage']['type'] == image/jpeg

2005-11-22 Thread Stephen Leaf
I use the fileinfo pecl. http://pecl.php.net/Fileinfo how to get a mime type: $info = new finfo( FILEINFO_MIME ); $mime = $info-file($filename); then my extention grabber: function getExtention() { switch ( $this-mimeType ) { case

Re: [PHP] Is there an alternative for $_FILES['guildimage']['type'] == image/jpeg

2005-11-22 Thread Stephen Leaf
The reason why I suggested the fileinfo idea was because IE and mozilla report the mime type differently. image/x-jpeg vs image/jpeg I believe it is. using fileinfo just standardizes what you need to check for. On Tuesday 22 November 2005 09:56 pm, twistednetadmin wrote: I don't think that is

Re: [PHP] Is there an alternative for $_FILES['guildimage']['type'] == image/jpeg

2005-11-22 Thread twistednetadmin
This did the trick: elseif ($_FILES['guildimage']['type'] == image/pjpeg or image/jpeg)