2012-05-03 78 views
0

我搜索了四處但我找不到我的問題。我有一個簡單的腳本將文件上傳到目標文件夾。move_uploaded_file無法正常工作

$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> 

我必須啓用阿帕奇或許真的?

+1

你能否詳細說明 '它不工作'?文件不移動嗎?函數是否返回true或false?這可能是因爲目標目錄中的寫入權限問題。 – xbonez

回答

3

tmpname應該tmp_name

+0

這麼簡單,哈哈。謝謝! – Veltar