无法在PHP中将上传的多个图像文件移动到文件夹中 [英] Unable to move uploaded multiple image file in folder in PHP
问题描述
我的代码在上传一张图片时运行正常。我试图上传三张图片并将其保存在另一个文件夹中。
我也更改了php.ini文件max_post_size = 32M
我没有得到任何错误,但无法在定义的位置移动上传文件。
html代码:
请帮忙,我在这个问题上遇到了很长时间。
我尝试过的:
< pre lang = PHP >
产品图片1: 产品图片2: 产品图片3:< / tr
php代码:
<?php
if(isset($ _ POST ['insert_post'])){
//获取产品图片
$ product_image1 = $ _FILES ['product_image'] ['name'];
move_uploaded_file($ _ FILES ['product_image'['tmp_name'],product_images / $ product_image1);
$ product_image2 = $ _FILES ['product_image2'] [ 'name'];
move_uploaded_file($ _ FILES ['product_image2'['tmp_name'],product_images / $ product_image2);
$ product_image3 = $ _FILES ['product_image3'] ['name'];
move_uploaded_file($ _ FILES ['product_image3'] ['tmp_name'],product_images / $ product_image3);
$ insert_product =插入产品(cat_id,product_color,product_title,product_price,product_desc,product_image,product_image2,product_image3,product_keywords,product_stock)值('$ product_cat',' $ product_color ' '$ PRODUCT_TITLE', '$ PRODUCT_PRICE', '$ product_desc', '$ product_image1', '$ product_image2',' $亲duct_image3','$ product_keywords','$ product_stock');
$ insert_pro = mysqli_query($ con,$ insert_product);
if($ insert_pro){
echoalert('Product has Beened!');
echowindow.open('index.php?insert_product' ,'_ self');
}``
}
_POST ['insert_post'] ))*
//获取产品图片
product_image1 =
< blockquote> _FILES ['product_image'] ['name'];
move_uploaded_file(
My code was working fine for one image upload.I tried to upload three images and save it in another folder.
I also changes php.ini file max_post_size=32M
I am not getting nay error but unable to move uploaded file in defined location.
html code:
please help,i am stuck in this issue for a long time.
What I have tried:
<pre lang="PHP">
Product Image1: Product Image2: Product Image3: </tr
php code:
<?php
if(isset($_POST['insert_post'])){
//getting product image
$product_image1 = $_FILES['product_image']['name'];
move_uploaded_file($_FILES['product_image'['tmp_name'],"product_images/$product_image1");
$product_image2 = $_FILES['product_image2']['name'];
move_uploaded_file($_FILES['product_image2'['tmp_name'],"product_images/$product_image2");
$product_image3 = $_FILES['product_image3']['name'];
move_uploaded_file($_FILES['product_image3']['tmp_name'],"product_images/$product_image3");
$insert_product = "insert into products (cat_id,product_color,product_title,product_price,product_desc,product_image,product_image2,product_image3,product_keywords,product_stock) values('$product_cat','$product_color','$product_title','$product_price','$product_desc','$product_image1','$product_image2','$product_image3','$product_keywords','$product_stock')";
$insert_pro = mysqli_query($con,$insert_product);
if($insert_pro){
echo "alert('Product Has Been Inserted!')";
echo "window.open('index.php?insert_product','_self')";
}``
}
_POST['insert_post'])){
//getting product image
product_image1 =
_FILES['product_image']['name'];
move_uploaded_file(
这篇关于无法在PHP中将上传的多个图像文件移动到文件夹中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!