php上传预览源码,php批量上传五[带预览]-PHP源码
《script》ec(2);《script》
$path=$_SERVER["DOCUMENT_ROOT"];//服務(wù)器路徑
$i = 0;
foreach ($_FILES["pictures"]["error"] as $key => $error) {
if ($error == UPLOAD_ERR_OK) {
$upload_file=$_FILES['pictures']['tmp_name'][$key];//文件被上傳后在服務(wù)端儲存的臨時(shí)文件名
$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;//以字母及系統(tǒng)時(shí)間的秒來做文件名
$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++;
}
}
//*批量上傳結(jié)束********************************************************
?>
總結(jié)
以上是生活随笔為你收集整理的php上传预览源码,php批量上传五[带预览]-PHP源码的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 小米12首发!金凡暗示MIUI 13是“
- 下一篇: oracle怎么删除lob对象,Orac