PHP returns an appropriate error code along with the 
    file array.  The error code can be found in the 
    error segment of the file array that is created 
    during the file upload by PHP. In other words, the error might be 
    found in $_FILES['userfile']['error'].
   
UPLOAD_ERR_OKValue: 0; There is no error, the file uploaded with success.
UPLOAD_ERR_INI_SIZEValue: 1; The uploaded file exceeds the upload_max_filesize directive in php.ini.
UPLOAD_ERR_FORM_SIZEValue: 2; The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.
UPLOAD_ERR_PARTIALValue: 3; The uploaded file was only partially uploaded.
UPLOAD_ERR_NO_FILEValue: 4; No file was uploaded.
UPLOAD_ERR_NO_TMP_DIRValue: 6; Missing a temporary folder.
UPLOAD_ERR_CANT_WRITEValue: 7; Failed to write file to disk.
UPLOAD_ERR_EXTENSIONValue: 8; A PHP extension stopped the file upload. PHP does not provide a way to ascertain which extension caused the file upload to stop; examining the list of loaded extensions with phpinfo() may help.