我想用php mysqli

时间:2017-10-10 08:10:46

标签: php

但是我收到了这个错误。任何人都可以帮助我

  

警告:move_uploaded_file()期望参数1为字符串,数组在第190行的/home/marquestech/public_html/parisara/admin/add.php中给出

            <section class="block" style="margin-left:450px;">
                <div class="billing">



                    <h3 class="sub-head">Add Image</h3>         


                    <div class="row">
                    <form name="form1" action="" method="post" enctype="multipart/form-data">

                        <div class="col-md-5 co-form">
                            <label>Category<span>*</span></label>
                        <select style="position:absolute;left:15px" name="productcategory" class="form-control input-field" >
                        <option selected disabled style="display:none;"></option>
                        <option value="C1">Construction</option>
                        <option value="C2">Interior</option>
                        <option value="C3">Sawmill </option>
                        <option value="C4">Painting </option>
                    </select>
                        </div>
                        <br>
                        <br>
                        <br>    


                        <div class="col-md-10 co-form">
                            <label>Name <span>*</span></label>
                            <input type="text" name="pnm" class="form-control input-field">
                        </div>

                        <div class="col-md-8 co-form">
                            <label>Image<span>*</span></label>
                            <input type="file" name="pimage[]" multiple class="form-control input-field">
                        </div>

                        <div class="col-md-10 co-form">

                            <input type="submit" value="upload" name="submit1" />
                        </div>

                        <tr>



                        </form>

<?php

//error_reporting(E_ALL);


    if(isset($_POST["submit1"]))
{

    for($i=0; $i<count($ftmp=$_FILES["pimage"]["tmp_name"]); $i++)

    {

        $proname=$_POST["pnm"];
    $productcategory =$_POST["productcategory"];

    $fnm=$_FILES["pimage"]["name"][$i];
    $ftmp=$_FILES["pimage"]["tmp_name"][$i];
    $ftype=$_FILES["pimage"]["type"][$i];
    $dst="./images/".$fnm;
    $dst1="images/".$fnm;


    $sql = "SELECT * FROM gallery_images where category ='$productcategory' and images ='$dst1'";
    $result = mysqli_query($con, $sql);


    if (mysqli_num_rows($result) > 0) 
    { 
        $error = 'ERROR: This product code already exist. Please use different product code!';// generate error message     
        echo $error;

    }
        else
        {

    ///////This is the line 190 ////////
move_uploaded_file($_FILES["pimage"]["tmp_name"],$fnm=$_FILES["pimage"]["name"]);
            mysqli_query($con,"insert into gallery_images (name,category,images,img_type) values('$proname','$productcategory','$dst1','$ftype')");
        }

    }





}


?>


                        </div>


                    </div>
                </section> 

0 个答案:

没有答案