Home › Forums › General Issues › Force an Image/File upload to a particular directory › Reply To: Force an Image/File upload to a particular directory
I’ve been learning from Stackexchange.
A. Allegedly, when the Media uploader Ajax appears, the user_id is no longer available. So there’s a solution (eventually arrived at) in calling the referrer at that point (
wp_handle_upload_prefilter), then parsing out
user_id, in order to fetch the user and username with which to rename the file. My working code does that.
Still, I think I need a way to conditionalise that in two ways: i) only for uploads where the referrer is user-edit.php or profile.php, ii) only for uploads where the instigator is the ACF field with key field_6140a6da30a17. The latter one may get me back to square one – establishing a line of communication between the field group in admin and the media uploader box.
B. The answer to my different question deals more specifically with adding parameters to an Ajax request. Don’t fully understand it yet, would need to take the time.
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!