Drupal 7 issue with programmatically set user picture(以编程方式设置用户图片的 Drupal 7 问题)
问题描述
我正在使用脚本以编程方式在 Drupal 7 中设置用户图片.该脚本如下所示:Drupal 7 以编程方式保存用户图片.
I am using a script to programmatically set the user picture in Drupal 7. The script is depicted here: Drupal 7 save user picture programmatically.
脚本工作正常,但是一旦为特定用户设置了用户图片,并且如果我尝试删除该图片(作为管理员或用户本人),服务器将返回:
The script works fine, but once the user picture has been set for a specific user, and if I try to delete that picture (as an admin or as the user himself) the server returns:
警告:取消链接(/home/hkdepot/public_html/drupal_dev_4/sites/default/files/avatars/upload/b8f1e69e83aa12cdd3d2babfbcd1fe27_101.jpg):drupal_unlink() 中的权限被拒绝(/home/hkdepot/public_html/drupal_dev_4/的第 2199 行包括/file.inc).
Warning: unlink(/home/hkdepot/public_html/drupal_dev_4/sites/default/files/avatars/upload/b8f1e69e83aa12cdd3d2babfbcd1fe27_101.jpg): Permission denied in drupal_unlink() (line 2199 of /home/hkdepot/public_html/drupal_dev_4/includes/file.inc).
文件不会从文件夹中删除.
The file does not get deleted from the folder.
这是我应该担心的吗?这是设置图片时的权利问题吗?我该如何处理?
Is this anything I should worry about? Is that a right's issue when setting the picture? How do I deal with it?
推荐答案
775 = rwxrwxr-x = 用户:读写执行;组:读写执行;世界:读取、执行
这只是意味着试图删除文件(可能是 www-data)的用户不是所有者,也不是所有权组.所以你要么需要
It just means that the user that is trying to delete the file (likely www-data) is not the owner nor is it in the ownership group. So you either need to
- 设置文件权限为
777
- 将所有者更改为要删除的用户
- 将要删除的用户添加到组中
进一步阅读:
- Linux 文件权限位掩码
- 如何在 Linux 中更改文件的所有者和组
这篇关于以编程方式设置用户图片的 Drupal 7 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:以编程方式设置用户图片的 Drupal 7 问题


基础教程推荐
- 如何在 Laravel 中使用 React Router? 2022-01-01
- 如何替换eregi() 2022-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01