php find file upload error

by Prakash 2014-03-19 15:18:03

The following code helps to identify the error of file upload :


switch( $_FILES['image']['error'] ) {
case UPLOAD_ERR_OK:
$message = false;;
break;
case UPLOAD_ERR_INI_SIZE:
case UPLOAD_ERR_FORM_SIZE:
$message .= ' - file too large (limit of bytes).';
break;
case UPLOAD_ERR_PARTIAL:
$message .= ' - file upload was not completed.';
break;
case UPLOAD_ERR_NO_FILE:
$message .= ' - zero-length file uploaded.';
break;
default:
$message .= ' - internal error #'.$_FILES['image']['error'];
break;
}

Tagged in:

1350
like
0
dislike
0
mail
flag

You must LOGIN to add comments