开发者

convert whole folder of images to 777 permissions?

I took an opportunity to batch optimise a folder of images from my site, of course i forgot the new images would not have the permissions 777.

Given the wiki-type nature of my site i need users to be able upload/replace the images!

is there anyway i can change the permissions of the whole folder's images either with a php script 开发者_运维百科or ftp program?


Use chmod() function, documentation you can find at http://pl2.php.net/manual/en/function.chmod.php

if ($handle = opendir('/path/to/files')) {

    /* This is the correct way to loop over the directory. */
    while (false !== ($file = readdir($handle))) {
        chmod($file, 0777);
    }

    closedir($handle);
}


In filezilla: Select all -> Right click -> File permissions (at the bottom)

with php: http://www.php.net/manual/en/function.chmod.php


How about chmod 777 *?

If you don't have access to the command-line, you should be able to use one of the Program execution functions such as exec

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜