移动上传的文件不起作用

时间:2014-02-21 15:41:25

标签: php

我正在尝试上传文件。本地它工作,我搜索互联网,但找不到我错了。 这是我的代码:

<?php
if(isset($_POST['uploaden_image']))
{
$paginanaam = mysqli_real_escape_string($link, $_POST['paginanaam_image']);
$link_image = mysqli_real_escape_string($link, $_POST['link_image']);
//1 Naam van de file
$imagename = $_FILES['image']['name'];
//2 Temporary directory van de file
$imagetmp = $_FILES['image']['tmp_name'];
//3 File grootte
$imagesize = $_FILES['image']['size'];
 //4 File type
$imagetype = $_FILES['image']['type'];
//5 Creëer het pad naar de afbeelding
$path = "/hsphere/local/home/mcbheer/mcwpo.nl/philippus/images/".$imagename;
//I tried every possibility over here



     if(move_uploaded_file($_FILES['image']['tmp_name'], $path))
     {
      echo "De afbeelding is met succes geüpload.";

      $sql = "INSERT INTO images (imagenaam, imagepath, imagetype, link_image,   paginanaam_images) VALUES ('".$imagename."', '".$path."', '".$imagetype."',  '".$link_image."', '".$paginanaam."')";
     if(!mysqli_query($link, $sql))
     {
       echo "Kon de query afbeelding aan de database toevoegen niet uitvoeren" .  mysqli_error($link);
       }
       }
        else
        {
          echo "Kon de afbeelding niet uploaden";
       }
       }
           ?>

这是上传表单

     <form name="uploadimage" id="uploadimage" action="<?php echo  $_SERVER['PHP_SELF']; ?>" enctype="multipart/form-data" method="post">
      <table><tr><td>
       <label>For which page?</label>
       </td><td>
        <input type="text" id="paginanaam_image" name="paginanaam_image">
      </td></tr><tr><td>
       <label>Linkt image</label>
      </td><td>
       <input type="text" id="link_image" name="link_image">
       </td></tr><tr><td>
       <input type="file" id="image" name="image">
       </td></tr><tr><td></td><td>
       <input type="submit" name="uploaden_image" value="uploaden" id="uploaden_image">
       </td></tr></table></form>

所以我用/和没有/和每个目录尝试了所有可能的路径。它不会起作用。我搜索了互联网,但找不到我做错了什么。本地它工作正常,但现在它不起作用。我也试过$ _SERVER ['document_root']。 “/图片/” 。 $ imagename 什么都行不通,我希望有人可以帮助我。提前谢谢。

0 个答案:

没有答案