作者:书友44802979 | 来源:互联网 | 2018-07-17 11:08
ec(2);$path$_SERVER["DOCUMENT_ROOT"];服务器路径 $i0; foreach($_FILES
$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++;
}
}
//*批量上传结束********************************************************
?>
}
if($_POST['fanhui']){
?>
}
?>