协助我在PHP文件上传中找到错误

时间:2015-06-15 13:35:53

标签: php file-upload

<form enctype="multipart/form-data" action="upload3.php" method="post">
            <input type="hidden" name="MAX_FILE_SIZE" value="1000000" />
            Choose a file to upload: <input name="uploaded_file" type="file" />
            <input type="submit" value="Upload" />
        </form>
  

PHP代码工作得更早但突然停止工作,可能是由于我在不知不觉中做出的一些改变

<?php 
      $uploaddir = "Uploads/";
      $uploadfile = $uploaddir.basename($_FILES['uploaded_file']['name']);

echo "<pre style=font-size:20px>";
     if(move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $uploadfile ))
     {
         echo "<b>File is valid,and was successfully uploaded !!!</b>.\n";
     }
     else
     {
         echo "<b>File upload Failed !!!</b>.\n";
     }
 ?>

错误是:

  

注意:未定义的索引:第6行的C:\ xampp \ htdocs \ Upload.php中的uploaded_file文件上传失败

第6行:

if(move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $uploadfile ))

0 个答案:

没有答案