sleepydad;11007257 wrote:So what's the best way to get the file type?
Well, since you're specifically targeting images, one possibility might be to use [man]getimagesize/man and make sure it doesn't return FALSE. (If you wanted to further limit the upload to only JPEG, GIF, and PNG images, you could additionally check the IMAGETYPE_XXX constant returned in index 2.)
sleepydad;11007257 wrote:I read about and tried fileinfo(), but couldn't figure out how to get it working on files pending upload. I was able to get the file type when using an absolute path, but cannot figure out how to do it otherwise.
What did you try? Note that you already have the absolute path for the uploaded file before you've moved it - it's in the "tmp_name" index (e.g. $_FILES['projectphoto']['tmp_name'][0]).
Also, note that PHP automatically deletes uploaded files that haven't been moved (e.g. via [man]move_uploaded_file/man) when the script has finished executing, so either you've omitted part of your actual code above or else you're immediately losing the uploaded files (even if they're valid).