为什么这个简单的代码不起作用(move_uploaded_file();)

时间:2018-04-14 03:28:35

标签: php file-upload windows-7

** php配置是正确的,我看到有人使用这段代码而且工作正常。但在我的情况下,我尝试了很多东西,它从不上传文件,它并没有告诉我有语法错误。

<?php
    if (isset($_FILES['file'])) {
        $name_file = $_FILES['file']['name'];
        $tmp_name = $_FILES['file']['tmp_name'];
        $location = "Imagenes/";
        move_uploaded_file($tmp_name, $location.$name_file);
    }
?>

<form method="POST" action="Upload.php" enctype="multipart/form-data" autocomplete="off">
    <div style="margin-top: 50%;">
        <label>Inserte la imagen que desee subir:</label>
        <input type="file" class="form-control" name="file" id="file">
        <input type="submit" style="margin-top: 10px; margin-left: 40%;" class="btn btn-outline-success" name="Upload" value="Upload" required="on">
    </div>
</form>**

0 个答案:

没有答案