lucky for you that "hack" wasnt a destructive one.
but as AIS4U said you should read more up on security in the manual.
also heres a article http://www.sitepoint.com/article/php-security-blunders
thats worth reading.
you must always validate users input.
heres a simple file validation function i just wrote
<?
$filename = $_FILES['userfile']['name'];
//File Validation.
$valid_filename =
preg_match('/^[A-z0-9_\-]+([.][A-z0-9_\-]+)+[A-z]{2,4}$/',$filename);
if ($valid_filename)
{
$type= $_POST['type'];
$file_info = pathinfo($filename);
//Valid image infomation.
$image_mime_types = array(
"image/gif","image/png","image/tiff",
"image/bmp","image/jpeg","application/x-shockwave-flash",
"application/octet-stream","image/photoshop","image/tiff",
"image/tif");
$image_extensions =
array("gif","png","tiff","jpeg","jpg","bmp","swf","psd");
if (in_array(strtolower($file_info['extension']),$image_extensions) &&
in_array($_FILES['userfile']['type'],$image_mime_types))
{
echo 'its a valid image!';
}
else
{
echo 'invalid image type.';
}
}
?>
that may help you.