$error) { if ($error == UPLOAD_ERR_OK) { $upload_file=$_FI" />

电脑安全

您当前的位置:主页 > 电脑安全 >

php批量上传五[带预览]-网络编程

来源:[db:来源]标题:   文件名    编辑:电脑技术全能网 时间:2019-09-20 18:31

原标题:php批量上传五[带预览]-网络编程
   $path=$_SERVER["DOCUMENT_ROOT"];//效劳器门路 $i = 0; foreach ($_FILES["pictures"]["error"] as $key => $error) { if ($error == UPLOAD_ERR_OK) { $upload_file=$_FILES['pictures']['tmp_name'][$key];//文件被上传后在效劳端贮存的常设文件名 $imgtype = strtolower(strrchr($_FILES['pictures']['name'][$key],".")); $name_1 = strtolower(substr($_FILES["pictures"]["name"][$key],0,2)); $upload_file_name= "lanmayi_".time().$name_1.$imgtype;//以字母及体系时光的秒来做文件名 $store_dir = $path."/up_img/";// 上传文件的贮存地位 $file_size_max = 100000000000;// 1M限度文件上传最大容量(bytes) $accept_overwrite = 0;//能否同意笼罩雷同文件 move_uploaded_file($upload_file,$store_dir.$upload_file_name); $new_img_name = $upload_file_name; $new_img_type = substr($imgtype,1,3); $new_img_path = $store_dir; $suo_name = Makesuo ($new_img_path,$new_img_name,$new_img_type); $sh_time = date('Y-m-d H:i:s'); $name = $_POST['name']; $pid = $id; $sql = "insert into lanmayi_img_show(pid,sh_name,sh_url,sh_suo,sh_time) values (".$pid.",'".$name[$i]."','".$upload_file_name."','".$suo_name."','".$sh_time."')"; $res = mysqli_query($conn,$sql); $i++; }}//*批量上传停止********************************************************?><script language="javascript">alert("图片上传胜利!")</script><?php}if($_POST['fanhui']){?><script language="javascript">window.location='pro_list.php?id=<?php echo $id?>';</script><?php}?>