Place new images into folder
-
Hi,
i’m using ACF PRO plugin to create frontend form where any user( even anonymous ) can add data and upload images. I want to keep all uploaded images in “user_uploads” folder. I tried to achive this by using FileBird API, here is an example of my code:function move_images_to_correct_folder ( $post_id, $type, $args, $form, $action ) { // $folderID = '8'; $api_key = 'FkrUV7ONns8duR6CM3GiNyx6YjE7VAHzeziEGpNj'; // $images = get_field( 'add_marker_step_2_images' ); if ( $images ) { // $ids = array(); // foreach ( $images as $single_image ) { array_push( $ids, $single_image['image']['id'] ); } // $link = get_site_url() . '/wp-json/filebird/public/v1/folder/set-attachment/?folder=' . $folderID . '&ids=' . json_encode( $ids ) . '&token=' . $api_key; // $response = wp_remote_post( $link ); } } add_action( 'acfe/form/submit/post/form=add-marker', 'move_images_to_correct_folder', 10, 5 );
but it fails. In response it says:
"success":false "data":{"mess":"Validation failed"}
here is an example of response. What am i doing wrong? I’m using FileBird Lite version.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Place new images into folder’ is closed to new replies.