我在将文件上传到网络共享文件夹时遇到问题。我可以通过在 IE 中使用 Windows 身份验证连接到该文件夹。脚本如下:
$target_path = '\\\\server\\images\\';
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
当我运行它时,我收到一条错误消息:
警告:move_uploaded_file(\server\images\pic_firefox.jpg) [function.move-uploaded-file]:无法打开流:第 6 行 C:\xxxxxxxxx\uploader.php 中的权限被拒绝
我认为那是因为 Windows 身份验证不能以这种方式工作。有没有办法可以使用用户名/密码上传文件?任何想法将不胜感激。