【发布时间】:2011-02-11 17:46:47
【问题描述】:
我正在使用 Drupal 6 和 filefield module。
我创建了一个简单的表单来将图像上传到服务器。我想在文件上传之前重命名文件。我注意到在field_file_save_upload 函数中,提到实现hook_file_insert 允许您操作文件的属性。我不确定如何实现这个钩子。我应该在新模块中还是直接在 field_file.inc 文件中实现它?是否应该命名为field_file_insert?
文档说明如下:
/**
* Save a file upload to a new location.
* The source file is validated as a proper upload and handled as such. By
* implementing hook_file($op = 'insert'), modules are able to act on the file
* upload and to add their own properties to the file.
...
*/
function field_file_save_upload($source, $validators = array(), $dest = FALSE)
【问题讨论】:
标签: drupal drupal-6 drupal-files