In you example $foto isn't empty, it's a space. That's why empty is returning false. You could do a str_replace(' ', '', $foto) but then that would break for any images with spaces in the name. I think what would be a better idea would be to check if the file exists, and check it's type.
To check the file exists
file_exists($foto);
Remember that if you're not in the directory where the file resides you'll have to prepend the path.
Where are you getting $foto_type from?
I would suggest the easiest way to check the file's type would be.
mime_get_content_type($foto);
Check the manual (located at www.php.net) for further details on the functions I've used here.
HTH
Bubble