我的编码有问题,上传工作正常,如果我没有上传任何图片,它会回显错误,如果我只上传一张图片,它不会显示任何错误消息,现在我想做它如果没有要上传的内容,它不会回显错误消息,但我想保留错误消息,以防万一出现问题,我知道有问题。谢谢!
// Upload begins!!
if ($_FILES['ufile']['name'][0] != "")
{
$target_path = "."."/uploads/".$petname."/".$_FILES['ufile']['name'][0];
copy($_FILES['ufile']['tmp_name'][0], $target_path);
$filesize1=$_FILES['ufile']['size'][0];
}
if ($_FILES['ufile']['name'][1] != "")
{
$target_path1 = "."."/uploads/".$petname."/".$_FILES['ufile']['name'][1];
copy($_FILES['ufile']['tmp_name'][1], $target_path1);
$filesize2=$_FILES['ufile']['size'][1];
}
if ($_FILES['ufile']['name'][2] != "")
{
$target_path2 = "."."/uploads/".$petname."/".$_FILES['ufile']['name'][2];
copy($_FILES['ufile']['tmp_name'][2], $target_path2);
$filesize3=$_FILES['ufile']['size'][2];
}
// Check for error!!
if($filesize1 || $filesize2 || $filesize3 != 0)
{
}
// If got error, show message
else
{
echo "<div class='error'>ERROR : There seems to be problem uploading the pictures.</div>";
}