【问题标题】:Change file permissions upon file upload--PHP?在文件上传时更改文件权限--PHP?
【发布时间】:2012-06-20 19:47:23
【问题描述】:

我有一个 PHP 上传脚本,并且正在尝试制作它,以便我网站的所有用户都可以编辑和读取上传的文件(即将上传文件的文件权限设置为 chmod 777)。文件上传到的目录具有正确的权限。但是,上传的文件没有。因为新文件会不断上传,所以我需要在上传过程中内置某种代码来设置/更改上传文件上传时的文件权限。

有什么想法吗?

【问题讨论】:

    标签: php upload permissions


    【解决方案1】:

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

    <?php
    
    /* 
     * All your upload code here; then pass the filename
     * and the base permissions to the chmod() below
     */
    
    chmod($uploadedFile, 0777);
    
    ?>
    

    【讨论】:

    • 轰隆隆,就是这样。谢谢!
    • 我需要这样做才能使其正常工作:chmod($uploadedFile, 0777);
    猜你喜欢
    • 2013-02-14
    • 1970-01-01
    • 2013-02-05
    • 2020-07-04
    • 1970-01-01
    • 1970-01-01
    • 2014-06-24
    • 2012-10-21
    • 2015-02-11
    相关资源
    最近更新 更多