move_uploaded_file无法正常工作

时间:2012-05-03 14:47:21

标签: php

我已经四处寻找,但我找不到自己的问题。我有一个简单的脚本,可以将文件上传到目标文件夹。

$target = "img/fotos-artikels/";
$target .= basename($_FILES["uploadBron"]["name"]); 
if(move_uploaded_file($_FILES["uploadBron"]["tmpname"], $target)) {
    echo "The file " . basename($_FILES["uploadBron"]["name"]) . " has been uploaded.";
} else {
    echo " Sorry there was a problem";
}

这就是形式:

<form enctype="multipart/form-data" action="" method="post">
    <label for="txtBronNaam">Naam:</label>
    <input type="text" name="txtBronNaam" id="txtBronNaam" value="" /><br />
    <label for="uploadBron">File:</label>
    <input type="file" name="uploadBron" id="uploadBron" value="" /><br />
    <input type="submit" name="" value="Voeg bron toe" />
</form>

我是否必须在apache中启用某些东西?

1 个答案:

答案 0 :(得分:3)

tmpname应为tmp_name