0

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

$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 中启用某些东西?

4

1 回答 1

3

tmpname应该tmp_name

于 2012-05-03T14:50:06.707 回答