Dumb question about isset() and empty()
So I was reading the PHP Manual about $_FILES and found this comment...
In the past you could unconditionally call $_FILES['profile_pic'] without ever having to worry about PHP spitting an "Undefined index: profile_pic" error (so long as the page posting had a file input on it (e.g. <input type="file" name="profile_pic" />)). This was the case regardless of whether or not the end user actually uploaded a file. These days, with so many people browsing the web via iPads, you have to explicitly check to see if the input isset($_FILES['profile_pic']) before calling into it, else you'll get the aforementioned error message. This is because iOS devices running Safari disable file inputs thereby causing them to be treated as if they don't exist. Time to update your scripts!
Just when I thought my "upload.php" script was done, yet another issue?! :mad:
This person talks about using isset(), but after some thought, I am wondering if my existing code doesn't check for the same issue, but just in a different way...
I think my code would handle the iPad/Safari issue this person talks about, but what do you think??
// Check for File.
// No File Exists.
$errors['upload'] = 'Choose a File.';
// File Exists.
$tempFile = $_FILES['userPhoto']['tmp_name'];