Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter gthreedev

    (@gthreedev)

    Thank you for your response, I already tested the example from https://docs.gravitypdf.com/v5/gfpdf_post_save_pdf but still the no copies have been ;
    created on the folder that I created. This is the exact code that I’m using right now:
    NOTE: the form id is 1 and I already created the folder on the root folder.

    add_action( 'gfpdf_post_save_pdf', function( $pdf_path, $filename, $settings, $entry, $form ) {
    
        if ( '1' == $form['id'] ) {
            /* The directory we want to copy our PDF to */
            $copy_to_dir = ABSPATH . 'PDFs/';
    
                /* Create the directory if it doesn't exist */
                if( ! is_dir( $copy_to_dir ) ) {
                    wp_mkdir_p( $copy_to_dir );
                }
    
            /* Ensure we get a unique filename for the directory we are copying to */
            $filename = wp_unique_filename( $copy_to_dir, $filename );
    
            /* Copy the PDF to the new directory */
            copy( $pdf_path, $copy_to_dir . $filename );
        }
    
    }, 10, 5 );
Viewing 1 replies (of 1 total)