选择语言 :

 Core_Upload::check_is_upload_file

判断是否上传的文件

boolean Core_Upload::check_is_upload_file( )
返回值
  • boolean
File: ./core/classes/upload.class.php
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
protected function check_is_upload_file()
{
    // 非上传的文件做抛错处理
    if(!is_uploaded_file($this->file['tmp_name']))
    {
        $error = (!isset($this->file['error'])) ? 4 : $this->file['error'];
 
        switch($error)
        {
            case UPLOAD::ERR_INI_SIZE :
                throw new Exception('Upload file exceeds limit', $error);
                break;
            case UPLOAD::ERR_FORM_SIZE :
                throw new Exception('Upload file exceeds form limit', $error);
                break;
            case UPLOAD::ERR_PARTIAL :
                throw new Exception('Upload file partial', $error);
                break;
            case UPLOAD::ERR_NO_FILE :
                throw new Exception('Upload no file selected', $error);
                break;
            case UPLOAD::ERR_NO_TMP_DIR :
                throw new Exception('Upload no temp directory', $error);
                break;
            case UPLOAD::ERR_CANT_WRITE :
                throw new Exception('Upload unable to write file', $error);
                break;
            case UPLOAD::ERR_EXTENSION :
                throw new Exception('Upload stopped by extension', $error);
                break;
            default :
                throw new Exception('Upload no file selected', $error);
                break;
        }
 
        return false;
    }
    else
    {
        return true;
    }
}