PHP: upload files to network shared folder
- by Xi
Hi there:
I have a problem uploading file to a network shared folder. I can connect to the folder by using windows authentication in IE. The script is as followed:
$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!";
}
when i ran it , I got an error message read:
Warning:
move_uploaded_file(\server\images\pic_firefox.jpg) [function.move-uploaded-file]: failed
to open stream: Permission denied in
C:\xxxxxxxxx\uploader.php on line 6
I thought that's because windows authentication doesn't work this way. Is there a way I can upload the file by using username/password? Any thoughts would be appreciated.