网上邻居看不到共享的move_uploaded_file

时间:2018-12-06 03:47:33

标签: php

使用PHP上传图像后,我想使图像可以被explorer.exe中的邻居复制,以便服务器共享它是D:\ xampp \ htdocs,这是代码。

@move_uploaded_file($_FILES[$upload_file_name]['tmp_name'], $dir_base.$newFileName);

if (file_exists(realpath($dir_base . $newFileName))) {
  error_log("\n realpath \n".print_r(  realpath($dir_base.$newFileName) ,true)."\n".date('Y-m-d H:i:s')."\n",3,"html_cache/saveData.html");
  //will echo D:\xampp\htdocs\projectname\data1\bg\1812061109410.png

  chmod( realpath($dir_base . $newFileName),0644);
}

chmod无法正常工作。安全只有管理员,没有所有人和系统。

如果我右键单击xampp / tmp并向其添加所有人的安全性。它工作正常,但如何通过纯PHP做到这一点?

1 个答案:

答案 0 :(得分:0)

正如@Sakura Kinomoto所说,chmod在Windows环境下不起作用。 使用cacls。

exec('echo Y|cacls '.realpath($dir_base . $newFileName).' /E /G Everyone:R');
相关问题