file_exists checks whether a file or directory is existent. this is a built-in php function. read the manual at php.net for more info.
catalog is the name of the folder that you create user folders. use any name u want instead of this name.
isset checks whether a variable is actually set. this is a buillt-in function as well. php.net is our friend btw.
checkfile is a function i wrote to check files. now this is tailored to my needs so you might need to change it.
function checkfile($inputname,$inputsize,$inputtype,$size){
global $error;
if($inputsize==0){
$error[]="Please select a picture for your product!";
}elseif($inputsize>$size){
$error[]="File size can be maximum ".$size." bytes!";
}elseif(is_uploaded_file($inputname)){
$file_type=$inputtype;
$allowed_types=array("image/bmp","image/gif","image/pjpeg","image/jpeg");
if(!in_array($file_type, $allowed_types)){
$error[]="File type not permitted! (Please use jpg, jpeg, bmp, or gif images)";
}
}
}
$error is the global array that i plug error messages in in a script. if an error occurs this array is initiated. if it exists i just display error messages and stop the execution of the script.
for your future questions
is_uploaded_file checks whether the file is uploded to your server by the client
in_array checks whether a value exists in an array. in my case, i filled an array with the image types i allow. then i retrieve the type of the image client has uploded and check whether it is among the allowed types. if it is not, i display an error message as usual.
burak