|Slightly improved file uploader
||[Thursday 20th November 2014 at 8:55 pm]
Anyway, enough ranting about nutters on the road. Remember the file uploader I hacked together earlier this year? Well, I discovered a slight flaw when using it with the Wii U - the filename provided by the console is static, and so later uploads overwrite earlier ones. That's easily fixed...
The change is only a few lines - the call to move_uploaded_file has been replaced with
$pathinfo = pathinfo($_FILES['file']['name'][$i]);
$dest = $pathinfo['filename'] . strftime('-%Y%m%d-%H%M%S.') . $pathinfo['extension'];
The result is each uploaded file has the current date and time appended to it (for example, vorpal.jpeg becomes vorpal-20141120-205045.jpeg). Obviously this will still overwrite files if you manage to upload the same filename multiple times within the same second, to which my answer is meh! As before, feel free to use it under the 3-clause BSD license.