更改文件上传的文件权限 - PHP?

时间:2012-06-18 19:25:42

标签: php upload permissions

我有一个PHP上传脚本,我正在努力使上传文件可以被我网站的所有用户编辑和读取(即,将上传文件的文件权限设置为chmod 777) 。上载文件的目录具有正确的权限。但是,上传的文件没有。由于新文件会不断上传,因此我需要在上传过程中内置一些代码,以便在上传时设置/更改上传文件的文件权限

有什么想法吗?

1 个答案:

答案 0 :(得分:3)

在上传功能后使用chmod() ..

<?php

/* 
 * All your upload code here; then pass the filename
 * and the base permissions to the chmod() below
 */

chmod($uploadedFile, 0777);

?>