Home › Forums › Backend Issues (wp-admin) › Detect which field is in use while uploading file › Reply To: Detect which field is in use while uploading file
Hello @elliot!
Buddy, is there some news on this point?
I’m working on a project that need to rename certain uploaded files, and I’m trying to do this with a WP hook (sanitize_file_name):
function new_filename_hash($filename) {
$info = pathinfo($filename);
$ext = empty($info['extension']) ? '' : '.' . $info['extension'];
$name = basename($filename, $ext);
return md5($name) . $ext;
}
add_filter('sanitize_file_name', 'new_filename_hash', 10);
It’s ok, but furthermore, I also would like to include some string based on the field name, but I get the same limitations of our friend @k12m.
I think that your ajax suggestion could be a great solution, but I’m asking you about this just in case of a novelty 🙂
Thank you!
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.