Upload File
PHP Code
+ 0 likes
Please Register to submit score.
| Average Score | 7.5 |
| Scores Submitted | 2 |
| Date Added | Dec 31, 2006 |
| Last Updated | May 28, 2007 |
| Tags | avi file gif jpg upload |
|
|
Introduction
PHP Snippet:
Upload File
Posted on Dec 31, 2006 11:56 pm
Posted on Dec 31, 2006 11:56 pm
It\'s not always a good idea to rely on $_FILES[][\'type\'] because this is simply the MIME type the client browser has given. This can potentially be faked by a client and browsers can also report the incorrect MIME type or give a generic MIME type.
You can use the getimagesize() function to get the MIME type of an image:
list($x,$x,$mime_type) = getimagesize($_FILES[\'files\'][\'tmp_name\']);
if ($mime_type == \'image/jpeg\' || $mime_type == \'image/gif\' || $mime_type == \'image/png\') {
....
You can use the getimagesize() function to get the MIME type of an image:
list($x,$x,$mime_type) = getimagesize($_FILES[\'files\'][\'tmp_name\']);
if ($mime_type == \'image/jpeg\' || $mime_type == \'image/gif\' || $mime_type == \'image/png\') {
....
PHP Snippet:
Upload File
Posted on Dec 31, 2006 11:58 pm
Posted on Dec 31, 2006 11:58 pm
There\'s also an error in your if statement that checks the type/size, it will accept a gif image of any size. It should be:
if ( (($_FILES[\"file\"][\"type\"] == \"image/gif\") || ($_FILES[\"file\"][\"type\"] == \"image/jpeg\")) && ($_FILES[\"file\"][\"size\"] < 20000))
if ( (($_FILES[\"file\"][\"type\"] == \"image/gif\") || ($_FILES[\"file\"][\"type\"] == \"image/jpeg\")) && ($_FILES[\"file\"][\"size\"] < 20000))
PHP Snippet:
Upload File
Posted on Apr 10, 2007 12:17 pm
Posted on Apr 10, 2007 12:17 pm
/*
First make a php file called \'upload.htm\'
put the following code in it
*/
isnt that a html file if the extension is .htm
;)
First make a php file called \'upload.htm\'
put the following code in it
*/
isnt that a html file if the extension is .htm
;)
PHP Snippet:
Upload File
Posted on May 29, 2007 11:37 am
Posted on May 29, 2007 11:37 am
peterpowell, i think he removed part of the code.
PHP Snippet:
Upload File
Posted on May 29, 2007 3:30 pm
Posted on May 29, 2007 3:30 pm
..Wtf happened? Why is everything gone..?
PHP Snippet:
Upload File
Posted on Feb 1, 2008 8:12 pm
Posted on Feb 1, 2008 8:12 pm
Yeah, the code just vanished. I really want this script.
PHP Snippet:
Upload File
Posted on Mar 8, 2008 12:51 am
Posted on Mar 8, 2008 12:51 am
It sounds like it was a really good script
the php probably got parsed and commented out or maybe it was seen as JavaScript. I don\'t know, but this seems like a really good script :D
the php probably got parsed and commented out or maybe it was seen as JavaScript. I don\'t know, but this seems like a really good script :D






