protected function handleUploadError($error)
    {
    
        switch($error){
            case UPLOAD_ERR_OK:
                return;
                break;
            case UPLOAD_ERR_INI_SIZE:
            case UPLOAD_ERR_FORM_SIZE:
                throw new Exception\UploadException(
                    'Maximum upload file size exceeded', array(), 10100+$error);
                break;
            case UPLOAD_ERR_PARTIAL:
                throw new Exception\UploadException(
                    'File was only partially uploaded', array(), 10100+$error);
                break;
            case UPLOAD_ERR_NO_FILE:
                throw new Exception\UploadException(
                    'No file was uploaded', array(), 10100+$error);
                break;
            case UPLOAD_ERR_NO_TMP_DIR:
                throw new Exception\UploadException(
                    'Invalid upload_tmp_dir; directory is not writable', array(), 10100+$error);
                break;
            case UPLOAD_ERR_CANT_WRITE:
                throw new Exception\UploadException(
                    'Unable to write uploaded file', array(), 10100+$error);
                break;
            default:
                throw new Exception\UploadException(
                    'Unknown error when uploading the file', array(), 10100+$error);
                break;
        }
    }