0

動的に作成されたフォルダーにファイルをアップロードしようとしています。localhost では正常に動作していますが、サーバーではエラーが表示されます。エラーは次のとおりです:-

警告: move_uploaded_file() [function.move-uploaded-file]: open_basedir 制限が有効です。ファイル (/tmp/php323kcy) が許可されたパス内にありません: (/home/) in /home/..../public_html/www..com./.../controller/add-product-process 83行目の.php

私のPHPコードはここにあります

<?php



include 'connection.php';

if(isset($_POST['product_name']) && ($_POST['category'])&& ($_POST['sub-category']) && ($_POST['product_qty']) && ($_POST['price']) && ($_POST['description']) && ($_POST['weight']))

{

 $pname = $_POST['product_name'];



 $category = $_POST['category'];

 $scategory = $_POST['sub-category'];

 $qty = $_POST['product_qty'];

 $price = $_POST['price'];

 $desc = $_POST['description'];

 $dp=$_POST['dp'];

 $offer= $_POST['offer'];

 $size=$_POST['size'];

 $weight=$_POST['weight'];

if(isset($_POST['color']))

{

$color=$_POST['color'];

}

else

{

$color = "N/A";

}

$query3 = mysql_query("select category_id from category where category_name='$category'");

$row3 = mysql_fetch_array($query3);



$query4 = mysql_query("select sub_category_id from sub_category where sub_category_name='$scategory'");

$row4 = mysql_fetch_array($query4);



$query1 = mysql_query("select product_id from stock");

while ($row = mysql_fetch_row($query1)) {

    $id = $row[0];

}

$str1 = substr($id, 2, 5);

if (($str1 >= 1) && ($str1 < 9)) {

    $str1++;

  echo  $new_id = "RD0000" . $str1;

} else if (($str1 >= 9) && ($str1 < 99)) {

    $str1++;

   echo $new_id = "RD000" . $str1;

} else if (($str1 >= 99) && ($str1 < 999)) {

    $str1++;

    echo $new_id = "RD00" . $str1;

} else if (($str1 >= 999) && ($str1 < 9999)) {

    $str1++;

   echo $new_id = "RD0" . $str1;

} else if (($str1 >= 9999) && ($str1 < 99999)) {

    $str1++;

   echo $new_id = "RD" . $str1;

} else {

    echo 'Error: Contact PSSP.';

}



$dirPath = "../products/$new_id";

$imgpath = "products/$new_id";

$result = mkdir($dirPath, 0755);

if ($result == 1) {

    echo $dirPath . " has been created";

} else {

    echo $dirPath . " has NOT been created";

}

define ("FILEREPOSITORY","../products/$new_id");

for ($i = 0; $i < sizeof($_FILES['uploadfile']['name']); $i++) {        

echo $path=$new_id.$i;

$filename = $dirPath.$path.'.jpeg';

           if (is_uploaded_file($_FILES['uploadfile']['tmp_name'][$i])) 

            {

            $filename2 = $imgpath."/".$path.'.jpeg';

            $fl[$i]=$filename2;

                        if ($_FILES['uploadfile']['type'][$i] != "image/jpeg") 

              {

                 echo "<p>Must be Image file.</p>";

              } 

             else if(file_exists($filename))

                {

              echo "already exist";

               }



              else 

                {

         //$name = $_POST['corname'];

         $result = move_uploaded_file($_FILES['uploadfile']['tmp_name'][$i], FILEREPOSITORY."/$path.jpeg");
            echo "result is".$result;
         if ($result == 1) 

            {

            echo "<p>File successfully uploaded.</p>";

            }

            else 

            {

            echo "not uploaded";

            }

            }

            }

            }

                        $files=implode(',',$fl);



> 
$query2 = mysql_query("insert into stock(product_id,product_name,category,sub_category,quantity,price,dp,offer,description,image,size,weight,color)values('$new_id','$pname','$row3[0]','$row4[0]','$qty','$price','$dp','$offer','$desc','$files','$size','$weight','$color')");

if (!$query2) {

    echo mysql_error();

} else {

    ?>

    <script language="javascript" type="text/javascript">

        // Print a message

        alert('Successfully Added..');

        // Redirect to some page of the site.

        window.location = '../add-product.php';

    </script>

    <?php



}

}

else

{

    echo "Error in page...";

}

?>

問題について私に知らせてください..

前もって感謝します

4

1 に答える 1