php为啥上传文件夹命名为upload就上传不成功,命名为uploads就成功,求解释?

<?php
if($_FILES["file"]["error"] > 0)
{
    echo "错误:" . $_FILES["file"]["error"] . "<br>";
}
else
{
    echo "上传文件名: " . $_FILES["file"]["name"] . "<br>";
    echo "文件类型: " . $_FILES["file"]["type"] . "<br>";
    echo "文件大小: " . ($_FILES["file"]["size"] / 1024) . " kB<br>";
    echo "文件临时存储的位置: " . $_FILES["file"]["tmp_name"]."<br/>";
   	$target_path  = "./upload/";
    $target_path .= basename( $_FILES[ 'file' ][ 'name' ] );
    echo $target_path;
    // Can we move the file to the upload folder?
    if( !move_uploaded_file( $_FILES[ 'file' ][ 'tmp_name' ], $target_path ) ) {
        // No
        echo '<pre>Your image was not uploaded.</pre>';
    }
    else {
        // Yes!
        echo "<pre>{$target_path} succesfully uploaded!</pre>";
    } 
}
?>

php最简单的上传代码,奇怪的是上传文件夹命名为upload就上传不成功,命名为uploads就成功,其他一字未动,两个文件夹权限全部设置为777   两个文件夹同时存在。

查看全部
tonycheungzyz
tonycheungzyz
2020/12/04 09:18
  • php
  • 点赞
  • 收藏
  • 回答
    私信

1个回复