iframe嵌入页面提交表单后关闭,怎样提交后让iframe再次打开

2024-12-22 00:31:58
推荐回答(1个)
回答1:

给你个参考:
HTML页面:



上传文件




上传








PHP页面:

$newfile = "";
$sub = "";
if(!empty($_POST['submit'])=="submit"){
$sub = $_POST['submit'];
if($_FILES['upload']['error']>0){
//echo "ERROR:".$_FILES['upload']['error']."";

}else{
$upload_dir = "upload";
$filename = $_FILES['upload']['name'];
if(!is_dir($upload_dir)){
if(!mkdir($upload_dir)){
echo "";
exit;
}
}else{
$str = "";
for($i=0;$i<4;$i++){
$str .=mt_rand(0,9);
}
$farr = explode(".",$filename);
$hz = end($farr);
$newfile = $upload_dir."/".time()."_".$str.".".$hz;
move_uploaded_file($_FILES['upload']["tmp_name"],$newfile);
}
}

}
?>


文件上传