本文介绍了以编程方式设置用户图片的 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).

文件不会从文件夹中删除.

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?

推荐答案

这只是意味着试图删除文件(可能是 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

  1. 设置文件权限为777
  2. 将所有者更改为要删除的用户
  3. 将要删除的用户添加到组中

进一步阅读:

这篇关于以编程方式设置用户图片的 Drupal 7 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 23:25
查看更多