我正在使用以下 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
但我在 in或 in都没有看到它C:\Windows\Temp\phpB4C9.tmp
。
我错过了什么吗?