note 102252 added to reserved.variables.files

From: Date: Fri, 04 Feb 2011 02:14:13 +0000
Subject: note 102252 added to reserved.variables.files
Groups: php.notes 
Request: Send a blank email to php-notes+get-176670@lists.php.net to get a copy of this message
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! -john ---- Server IP: 69.147.83.197 Probable Submitter: 75.72.250.179 ---- Manual Page -- http://www.php.net/manual/en/reserved.variables.files.php Edit -- https://master.php.net/note/edit/102252 Del: integrated -- https://master.php.net/note/delete/102252/integrated Del: useless -- https://master.php.net/note/delete/102252/useless Del: bad code -- https://master.php.net/note/delete/102252/bad+code Del: spam -- https://master.php.net/note/delete/102252/spam Del: non-english -- https://master.php.net/note/delete/102252/non-english Del: in docs -- https://master.php.net/note/delete/102252/in+docs Del: other reasons-- https://master.php.net/note/delete/102252 Reject -- https://master.php.net/note/reject/102252 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#176670) next »