我是 php 的菜鸟,我需要一些帮助。我有一个上传脚本,可以将某些内容上传到我的服务器。因此,在我上传文件后,我收到一条消息your file was upload
,我希望将此消息发布在我的 html 上传页面(主页)中,代码如下:
if(empty($errors)===true){
move_uploaded_file($file_tmp,"upload/".$file_name);
echo "Your file was upload!"; <- I want this line to be printed in other page //
}else{
print_r($errors);
}
}
编辑: 如果你能帮我解决这两个问题,我发现我的脚本有一个错误:
$file_name=$_FILES['file']['name'];
$file_tmp =$_FILES['file']['tmp_name'];
$file_type=$_FILES['file']['type'];
$file_ext=strtolower(end(explode('.',$_FILES['file']['name'])));
$extensions = array("rar","zip","jpeg","jpg","png","gif");
if(in_array($file_ext,$extensions)=== false){
$error[]= "Extension not allowed, please choose a RAR or ZIP file or if you upload an image use JPEG, JPG, PNG or GIF format.</br> Thank you!";
}
这是我限制文件上传的代码,但它不会受到限制,请告诉我为什么?
希望我足够明确。谢谢 !