PHP文件上传提交不移动的图像


PHP File Upload Submit not moving Image

Hello Stackers,

我的PHP文件上传脚本有问题。我可以选择一个图像,然后点击上传按钮,但它甚至没有将图像上传到我说应该去的地图上,事实上,我甚至根本找不到图像。

文件夹在我的IIS wwwroot中。路径为wwwroot/magieweb/images/uploader

我做错了什么?

PHP

if(isset($_FILES['image'])){
      $errors= array();
      $file_name = $_FILES['image']['name'];
      $file_size = $_FILES['image']['size'];
      $file_tmp = $_FILES['image']['tmp_name'];
      $file_type = $_FILES['image']['type'];
      $file_ext=strtolower(end(explode('.',$_FILES['image']['name'])));
      $expensions= array("jpeg","jpg","png","gif");
      if(in_array($file_ext,$expensions)=== false){
         $errors="<font color='#e74c3c'>Dit bestand kan niet geupload worden. (Fout EXT)</font>";
      }
      if(empty($errors)==true) {
         move_uploaded_file($file_tmp,"wwwroot/magieweb/images/uploader/".$file_name);
         $errors = "<font color='#16a085'>Het is gelukt. Het adres is <strong>magiehotel.nl/magieweb/images/uploader/".$_FILES['image']['name']."</strong></font><br><br>";
      }else{
         print_r($errors);
      }
   }

HTML表单

  <form action = "" method = "POST" enctype = "multipart/form-data">
                  <b>Type/pad</b><br>
                  <select name="path">
                  <option value="magieweb/images/publicroom">Publieke Kamer</option>
                  <option value="magieweb/images/news">Nieuwsafbeelding</option>
                  <option value="app/tpl/skins/Habbo/swf/c_images/album1584">Badges</option>
                  </select><div style="margin-bottom:5px;"></div>
                  <b>Afbeelding</b><input type = "file" name = "image" /> <br>


         <input type = "submit"/> of <a href="ase-dash.php">Annuleren</a>
         <br><br>
                <ul style="border: 1px solid #2087A1; list-style-type: none; margin-right:40px;">
            <li><strong style="color:#2087A1; margin-top:3px; margin-bottom:3px;">Uploadbestandinformatie</strong></li> 
            <li><strong>Bestandnaam:</strong> <?php echo $_FILES['image']['name'];  ?>
            <li><strong>Bestandgrootte:</strong> <?php echo $_FILES['image']['size'];  ?>
            <li><strong>Bestandtype:</strong> <?php echo $_FILES['image']['type'] ?>
         </ul>
               </form>

我确实收到了成功通知,也收到了图像数据,但我在任何地方都找不到图像。

提前感谢

看起来您使用的是windows系统,您给出的路径完全错误。

如果您使用的是windows系统,请更改文件夹的绝对路径并尝试。

所以路径会像下面一样

C:/examplep/your_project/upload_folder/

还要确保文件夹具有上载文件的写入权限。