我正在使用 Drupal 6 和filefield 模块。
我创建了一个简单的表单来将图像上传到服务器。我想在文件上传之前重命名文件。我注意到在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)