I have a problem with a file upload form. If I submit the form without uploading any file. It thinks the file was uploaded when it was missing.
if(isset($_FILES["user_image"]))
{
$extension = explode('.', $_FILES['user_image']['name']);
$new_name = rand() . '.' . $extension[1];
$destination = '../upload/' . $new_name;
move_uploaded_file($_FILES['user_image']['tmp_name'], $destination);
return $new_name;
}
4
as 4 means "nothing uploaded"