I'm working with Drupal 6 and the filefield module.
I created a simple form to upload an image to the server. I want to rename the file before it gets uploaded. I noticed that inside the field_file_save_upload
function, it is mentioned that implementing hook_file_insert
allows you to manipulate the file's properties. I'm not sure on how to implement this hook. Should I implement it in a new module or directly inside the field_file.inc file? Should it be named as field_file_insert
?
The documentation states the following:
/**
* 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)