2017-03-02 46 views
0

我已经上传了服务器上的项目,除了少数东西外,每件事情都很好。无法在mysql服务器上载图像

我无法上传服务器上的文件映像,请检查错误。

我甚至设置权限为777

警告:move_uploaded_file(../图像/无法upload.jpg):未能打开流:在/ SRV/disk14没有这样的文件或目录在线路15 /2293074/www/cms.mohsinyounas.info/admin/includes/add_posts.php

警告:move_uploaded_file()以:无法 '/ TMP/phpx2WZ8c' 移动到” ../images/fail上传.jpg'in line 15上的/srv/disk14/2293074/www/cms.mohsinyounas.info/admin/includes/add_posts.php

谢谢。

<?php 
     include "./function.php"; 
     global $con; 

     if(isset($_POST['create_post'])) { 
      $post_image  = $_FILES['post_image']['name']; 
      $post_image_temp = $_FILES['post_image']['tmp_name']; 

      move_uploaded_file("$post_image_temp","../images/$post_image"); 

      $sql = "INSERT INTO posts (post_image) VALUES ('$post_image')"; 
      $result = mysqli_query($con,$sql); 
      confirm($result); 
     } 
?> 
+0

是'function.php'文件包括? –

+0

我认为这是权限问题检查这个目录是否存在?并检查权限也。 – Shefali

+1

'/ images /'文件夹是否真的位于'/ admin /'文件夹中?或者你也许需要更高一级? – jeroen

回答

1

改变此密码,你必须从变量move_uploaded_file删除 “”()

<?php 
    include "./function.php"; 
    global $con; 
    if(isset($_POST['create_post'])) { 
     $post_image =$_FILES['post_image']['name']; 
     $post_image_temp =$_FILES['post_image']['tmp_name']; 
     $path = "../images/".$post_image; 
     move_uploaded_file($post_image_temp,$path); 
     $sql = "INSERT INTO posts (post_image) 
       VALUES ('$post_image')"; 
     $result=mysqli_query($con,$sql); 
     confirm($result); 
    } 
?> 
相关问题