如何将我的图像上传到与我的电脑共享文件夹图像的另一台计算机

时间:2013-01-09 08:38:46

标签: php

我想将我的图片上传到另一台与我的电脑共享文件夹图像的计算机。 这是图片的路径:

//92.62.178.149/Documents/Images

这是我的代码:

chmod ("//92.62.178.149/Documents/Images/", 0777);
move_uploaded_file($tmpname, "//92.62.178.149/Documents/Images/" . $str . "." . $type);

但我收到了一些警告:

  

警告:chmod()[function.chmod]:第66行的C:\ xampp \ htdocs \ 2new \ ClassImage.php中没有这样的文件或目录

     

警告:move_uploaded_file(// 92.62.178.149/Documents/Images/d8426230-5a36-11e2-b0bc-616263646566.jpeg)[function.move-uploaded-file]:无法打开流:C:\中的权限被拒绝第68行的xampp \ htdocs \ 2new \ ClassImage.php

     

警告:move_uploaded_file()[function.move-uploaded-file]:无法将'C:\ xampp \ tmp \ php782.tmp'移动到'//92.62.178.149/Documents/Images/d8426230-5a36-11e2第68行的C:\ xampp \ htdocs \ 2new \ ClassImage.php中的-b0bc-616263646566.jpeg'

1 个答案:

答案 0 :(得分:1)

试试这个

$destinationFolder = "\\\\92.62.178.149\\Documents\\Images\\";
chmod ($destinationFolder , 0777);
move_uploaded_file($tmpname, $destinationFolder  . $str . "." . $type);

注意: -

When you are running a PHP script from the browser, you are not running it under your 
user account. You are running under whatever the HTTP server uses as the user name. 
So even if you have access to the folder, the server may not. 
The easiest fix is to give the serverwrite permission to that folder.