Home › Forums › Backend Issues (wp-admin) › Read content of uploaded PDF file and save it ACF field › Reply To: Read content of uploaded PDF file and save it ACF field
$document_file = get_field('document_file', $post_id);
$document_file = get_attachment_file(get_field('document_file', $post_id, false));
setting the last parameter
false for ACF gets the unformatted value, in this case the attachment ID. The WP function get_attachment_file() loads that file into the variable. Then you can pass this to convert it to text.
Then you call update_field() to update the text field with what is returned.
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!
🤔 Curious about the ACF user experience? So are we! Help guide the evolution of ACF by taking part in our first ever Annual Survey and guarantee you’re represented in the results. https://t.co/0cgr9ZFOJ5— Advanced Custom Fields (@wp_acf) May 8, 2023
© 2023 Advanced Custom Fields.