开发者

Why can't I download files uploaded with PHP?

I have created a custom CMS with PHP and it uploads files to a directory with 777 permissions on it. When the files are uploaded they are given 600 with apache being the owner, therefore I can't download them through FTP as the main FTP user.

Anybody have a开发者_JAVA技巧ny ideas? I have tried changing the permission but don't have rights due to the owner being apache.


You cant chmod the files, but 'apache' can: after uploading an moving the file,change the permissions in the same script. As it is run by apache, it is allowed to do so.

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


For uploading files it is important to note that uploading files without explicitly setting permissions after is a bad practice.

I would take the link Nanne provided and begin to add that to your upload script. This will ensure that the files are given the appropriate permissions for each situation you will need them.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜