我用下面的PHP腳本上傳文件後:找不到我的檔案在PHP文件上傳
<?php
$dest_dir="C:\Users\Maria\Documents\IT-learning";
foreach ($_FILES as $file_name => $file_array) {
echo "path: ".$file_array['tmp_name']."<br/>\n"; //output is "C:\Windows\Temp\phpB4C9.tmp" instead
echo "name: ".$file_array['name']."<br/>\n";
echo "type: ".$file_array['type']."<br/>\n";
echo "size: ".$file_array['size']."<br/>\n";
if (is_uploaded_file($file_array['tmp_name'])) {
move_uploaded_file($file_array['tmp_name'], $dest_dir.$file_array['name'])
or die ("file exists but can't be moved");
echo "File uploaded successfully.";
} else {
echo "File does not exist.";
}
} //single file is fine. opened single file is
?>
輸出是這樣的:
path: C:\Windows\Temp\phpB4C9.tmp
name: test2.xml
type: text/xml
size: 4523
File uploaded successfully.
我的問題是我除了在原始目錄中,在我的電腦上看不到test2.xml
文件。從我的理解,我應該看到它移動到C:\Users\Maria\Documents\IT-learning
。但我沒有看到它在C:\Users\Maria\Documents\IT-learning
或C:\Windows\Temp\phpB4C9.tmp
。
我想知道什麼嗎?
你使用了什麼服務器包? – Daedalus 2013-04-20 02:39:42