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
Hi @k12m
This may not be possible with an ACF file / image field.
There is no way to tell which field launched the uploader as this is all done with JS (PHP would not know…)
Perhaps you could write some custom JS which listens to a click on the acf file field, when clicked, an AJAX call is sent to a PHP function which saves the field_name as a custom wp options (wp_options table).
Then in your upload script, you could read the value from the wp_options table to find which was the last clicked field?
It’s not pretty, but it would work
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.