Skip to content

Instantly share code, notes, and snippets.

@benmj
Created February 14, 2013 22:52
Show Gist options
  • Save benmj/4957145 to your computer and use it in GitHub Desktop.
Save benmj/4957145 to your computer and use it in GitHub Desktop.
<?php
foreach ($_FILES as $file) {
switch($file['error']) {
case UPLOAD_ERR_INI_SIZE:
error_log("The uploaded file exceeds the upload_max_filesize directive in php.ini. : " . $file['name']);
break;
case UPLOAD_ERR_FORM_SIZE:
error_log("The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form. " . $file['name']);
break;
case UPLOAD_ERR_PARTIAL:
error_log("The uploaded file was only partially uploaded. " .$file['name']);
break;
case UPLOAD_ERR_NO_FILE:
error_log("No file was uploaded." . $file['name']);
break;
case UPLOAD_ERR_NO_TMP_DIR:
error_log("Missing a temporary folder." . $file['name']);
break;
case UPLOAD_ERR_CANT_WRITE:
error_log("Failed to write file to disk." . $file['name']);
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment