復制代碼 代碼如下:
switch($_FILES[$field]['error']) {
case 1:
// 文件大小超出了服務器的空間大小
$this->setError("The file is too large (server).");
break;
case 2:
// 要上傳的文件大小超出浏覽器限制
$this->setError("The file is too large (form).");
break;
case 3:
// 文件僅部分被上傳
$this->setError("The file was only partially uploaded.");
break;
case 4:
// 沒有找到要上傳的文件
$this->setError("No file was uploaded.");
break;
case 5:
// 服務器臨時文件夾丟失
$this->setError("The servers temporary folder is missing.");
break;
case 6:
// 文件寫入到臨時文件夾出錯
$this->setError("Failed to write to the temporary folder.");
break;
}