Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
Is there a way to get the filefield path on during node submit (save process)?
I need to write a text file in the same directory as my files when I submit a node with file field and custom file path.
I was hoping to use hook_form_submit_handler($form, &$form_state) but $form_state['values'] does't include the custom path only private://files
Can I find the custom path during my submit handler? Where would you suggest writing the code to write a txt file (including submitted node field values) to same path as the files saved files?
Any help appreciated!
Comments
Comment #1
Deciphered CreditAttribution: Deciphered commentedThe whole reason behind this module is that the entity tokens are not known until the entity is actually saved, and as such the file can not be moved into it's destination until after the the entity is saved.
File (Field) Paths is currently doing it's magic on hook_field_storage_pre_insert/update, so you could implement your own version of that hook, ensuring it runs after File (Field) Paths, and you will be able to get the information you are after.