PHP: upload files to network shared folder

Posted by Xi on Stack Overflow See other posts from Stack Overflow or by Xi
Published on 2010-02-19T22:10:52Z Indexed on 2010/03/22 3:01 UTC
Read the original article Hit count: 511

Filed under:
|
|
|
|

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.

© Stack Overflow or respective owner

Related posts about php

Related posts about network