PHP向服务器上传图像



我做了一个上传系统,我正在我的计算机上测试它,使用localhost xampp服务器,它工作正常,但我将它移动到主机,我得到这个错误:

PHP Warning:  Unknown: open_basedir restriction in effect. File(C:WindowsTEMP) is not within the allowed path(s): (E:Domainssite.com) in Unknown on line 0
PHP Warning:  File upload error - unable to create a temporary file in Unknown on line 0
PHP Warning:  file_get_contents() [<a href='function.file-get-contents'>function.file-get-contents</a>]: Filename cannot be empty in E:Domainssite.comwwwrootadminaddexec.php on line 12
PHP Warning:  getimagesize() [<a href='function.getimagesize'>function.getimagesize</a>]: Filename cannot be empty in E:Domainssite.comwwwrootadminaddexec.php on line 14

下面的文件:

addexec.php

<?php
    include('connect.php');
        if (!isset($_FILES['image']['tmp_name'])) {
        echo "";
        }else{
        $file=$_FILES['image']['tmp_name'];
        $image= addslashes(file_get_contents($_FILES['image']['tmp_name']));
        $image_name= addslashes($_FILES['image']['name']);
        $image_size= getimagesize($_FILES['image']['tmp_name']);

            if ($image_size==FALSE) {
                echo "That's not an image!";
            }else{
                move_uploaded_file($_FILES["image"]["tmp_name"],"../reservation/img/products/" . $_FILES["image"]["name"]);
                $location=$_FILES["image"]["name"];
                $pname=$_POST['pname'];
                $desc=$_POST['desc'];
                $price=$_POST['price'];
                $cat=$_POST['cat'];

                $update=mysql_query("INSERT INTO products (imgUrl, product, Description, Price, Category)
    VALUES
    ('$location','$pname','$desc','$price','$cat')");
    header("location: products.php");
                exit();
                }
        }
    ?>

我不知道如何设置一个临时文件夹,我需要一些帮助来解决这个问题。我能做什么?我已经将服务器上的权限设置为777并关闭了php安全模式。

;是否允许HTTP文件上传。

file_uploads =

;HTTP上传文件的临时目录(如果没有,将使用系统默认值);指定)。

upload_tmp_dir = " D: xampp tmp"

尝试更改php.ini中上述位置,可能会为您工作

相关内容

  • 没有找到相关文章

最新更新