• At present I use the filter hook wp_handle_upload_prefilter to rename files and upload_dir to alter path/URLs. Now I require the path/URL to be altered depending on the extension of the file.

    upload_dir does not parse the file name and wp_handle_upload_prefilter does not parse the path/URL.

    Do you know of a way that will allow me to manipulate the path/URL based on the extension of a file? Or perhaps there is a hook that can do both alter the path/URL and rename the file? I’m welcome to all ideas.

    Thanks in advance.

Viewing 1 replies (of 1 total)
  • Thread Starter I

    (@iahmed-1)

    Just a quick update as I missed something quite obvious; wp_handle_upload_prefilter filter is called before upload_dir so I’ve set a global variable in the former which I access in the latter upload_dir hook. It gets the job done but could you please confirm this is a correct way of doing this? Also, are there any caveats I should be aware of?

    Thanks

Viewing 1 replies (of 1 total)
  • The topic ‘Upload hooks for manipulation’ is closed to new replies.