I am actually uploading an image from an url like this
$create_image = new JDN_Create_Media_File( $image_url );
$image_id = $create_image->attachment_id;
JDN_Create_Media_File is from here.
I am now updating the image of the user with the acf/save_post with the name of the field and it works.
I tried using it with acf/pre_save_post it did not work. Maybe it is because the image is not uploaded quickly enough? The strange thing is that using the update_field function with an image field inside a post worked (with name and with key field). I also tried updating a field for a user and it also worked (with name and with key field), it gave me the correct image ID.
Thanks for you help.
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!