Re: [PHP] Is it possible to test an uploaded file to check the type?

2003-07-14 Thread David Otton
On Mon, 14 Jul 2003 00:24:03 -0400, you wrote: Looking for opinions. Can a spoofed uploaded file hurt a script or a webserver?? Reason why Im asking is because, I looked over the magic.mime file on my server, and I see that it doesn't support flash files (I may be wrong), of which I currently

Re: [PHP] Is it possible to test an uploaded file to check the type?

2003-07-14 Thread Marek Kilimajer
David Otton wrote: On Mon, 14 Jul 2003 00:24:03 -0400, you wrote: ... The show-resource.php script just has to set the correct mime type header and stream out the contents of the file. And it is safe to use the browser supplied mime type here. -- PHP General Mailing List (http://www.php.net/) To

Re: [PHP] Is it possible to test an uploaded file to check the type?

2003-07-14 Thread Nadim Attari
So, check $_FILES['userfile']['type'] against a set of allowed file types, and you're set... What about this: array getimagesize ( string filename [, array imageinfo]) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Is it possible to test an uploaded file to check the type?

2003-07-14 Thread Gerard Samuel
Thank you for your reply. A little background on what Im doing with file uploading. 1. Im allowing registered users to upload avatars for their own usage. 2. Im allowing image uploading for submitted articles by certain registered users. 3. And Im currently constructing a media gallery, where

Re: [PHP] Is it possible to test an uploaded file to check the type?

2003-07-14 Thread Joel Rees
Is it possible to check a file in $_FILES['userfile']['tmp_name'] to make sure it is of a certain format? I want to allow a user to only upload jpegs or mpegs, and want to check what format the file is in. If there are only a few types, and you know what those types should look like, it

Re: [PHP] Is it possible to test an uploaded file to check the type?

2003-07-13 Thread Marek Kilimajer
If you have compiled php with --enable-mime-magic, you can use mime_content_type() Dan Anderson wrote: Is it possible to check a file in $_FILES['userfile']['tmp_name'] to make sure it is of a certain format? I want to allow a user to only upload jpegs or mpegs, and want to check what format

Re: [PHP] Is it possible to test an uploaded file to check the type?

2003-07-13 Thread Gerard Samuel
The upload process, already collects info on file types when you upload. From the manual - $_FILES['userfile']['type'] The mime type of the file, if the browser provided this information. An example would be image/gif. So, check $_FILES['userfile']['type'] against a set of allowed file

Re: [PHP] Is it possible to test an uploaded file to check the type?

2003-07-13 Thread David Otton
On Sun, 13 Jul 2003 13:32:00 -0400, you wrote: The upload process, already collects info on file types when you upload. From the manual - $_FILES['userfile']['type'] The mime type of the file, if the browser provided this information. An example would be image/gif. So, check

Re: [PHP] Is it possible to test an uploaded file to check the type?

2003-07-13 Thread Gerard Samuel
David Otton wrote: $_FILES['userfile']['type'] The mime type of the file, if the browser provided this information. An example would be image/gif. So, check $_FILES['userfile']['type'] against a set of allowed file types, and you're set... A client-supplied value isn't going

Re: [PHP] Is it possible to test an uploaded file to check the type?

2003-07-13 Thread Gerard Samuel
Gerard Samuel wrote: A client-supplied value isn't going to be too useful - it can be spoofed, or may not be present. (I believe a Windows browser would set the mime-type based purely on the file extension, though I haven't tested this myself). Then my apologies. I thought php determined the

[PHP] Is it possible to test an uploaded file to check the type?

2003-07-12 Thread Dan Anderson
Is it possible to check a file in $_FILES['userfile']['tmp_name'] to make sure it is of a certain format? I want to allow a user to only upload jpegs or mpegs, and want to check what format the file is in. Thanks in advance, Dan Anderson -- PHP General Mailing List (http://www.php.net/) To

Re: [PHP] Is it possible to test an uploaded file to check the type?

2003-07-12 Thread Jason Wong
On Sunday 13 July 2003 01:24, Dan Anderson wrote: Is it possible to check a file in $_FILES['userfile']['tmp_name'] to make sure it is of a certain format? I want to allow a user to only upload jpegs or mpegs, and want to check what format the file is in. If on un*x you can use the 'file'