need to check for errors before checking is_uploaded_file.
throws an exception when no file is uploaded.