我有以下代码:
if (!is_uploaded_file($_FILES['sb_file']['tmp_name']))
{
echo "Error in Uploading File <br>".$_FILES["sb_file"]["error"][$count];
}
is_uploaded_file
返回 false ,甚至 $_FILES['sb_file']['errors'] 返回 0 但文件没有在目标文件夹中移动。如何跟踪错误?
foreach ($_FILES['sb_file']['name'] as $filename)
{
//make sure no empty thing goes
if($filename!=""&&$filename!=null)
{
$temp = explode(".", $filename);
$extension = end($temp);
$upload_folder = "/home/content/w/k/1/wk1989/html/".trim($config["UPLOAD_FOLDER"]);
if(!(in_array($extension, $allowedExts)))
print "$filename has Invalid file Type <br />";
else
{
$uploaded_file_name = $filename."-".date("YmdHis").".".$extension;
if ($_FILES["sb_file"]["error"][$count] > 0)
{
echo "<br />Error: " . $_FILES["sb_file"]["error"][$count] . "<br />";
}
else
{
$target_path = "uploads/";
$target_path = $target_path.basename( $file_upload['name']);
print "Path = $target_path <br>";
// if(move_uploaded_file($file_upload['tmp_name'], $target_path)) {
// // echo "The file ". basename( $file_upload['name']). " has been uploaded";
// } else{
// //echo "There was an error uploading the file, please try again!";
// }
move_uploaded_file($_FILES["sb_file"]["tmp_name"][$count],$upload_folder.$uploaded_file_name);
// if (!is_uploaded_file($_FILES['sb_file']['tmp_name'][$count]))
// {
// echo "Error in Uploading File <br>".$_FILES["sb_file"]["error"][$count];
// }
// else
// {
//
// }
$is_upload = true;
echo "Uploaded = ".$upload_folder.$uploaded_file_name;
}
if($is_upload)
{
$uploaded_files[] = $upload_folder.$uploaded_file_name;
}
}
}
$count++;
}