You need to check if its empty before doing anything else. That way it breaks out of the code. Everything else needs to be nested in an else statement so it only runs if those conditions are met.
PHP Code:
// variable and function declarations above
if(empty($_FILES))
{
// handle error of no file being sent
}
else
{
// has data do work and other stuff to get image where it needs to be
}
Also your using the password as a directory without creating it.
PHP Code:
$passDir = mkdir("uploads/" . $password);
$pFlag = 0;
if($passDir)
{
$pFlag = 1;
}
else
{
$pFlag = 0;
}
if($pFlag > 0)
{
// move file here
}
else
{
// return folder not there
}
Just a suggestion, and you need to sub-string the files name to get the extension type.