判断是否上传的文件
boolean Core_Upload::check_is_upload_file( )
boolean
292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333protected
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;
}
}