• Resolved jodyfr

    (@jodyfr)


    Hi, we’re using Forminator with the following code in functions.php to ensure that an uploaded file’s name doesn’t have random characters added to it. This was working well until the last update to 1.29.0 a few days ago. Now uploaded files are getting stuck in a /temp folder inside the forminator upload path, and they have the random characters added again. Any idea what might have changed? Thanks in advance for any help you can offer.

    add_action( ‘forminator_form_before_handle_submit’, ‘wpmudev_uploaded_filename_fix’, 10, 1 );
    add_action( ‘forminator_form_before_save_entry’, ‘wpmudev_uploaded_filename_fix’, 10, 1 );
    function wpmudev_uploaded_filename_fix( $form_id ) {
    if ( $form_id != 1675 ) { //Please change the form ID
    return;
    }

    add_filter('wp_unique_filename', 'wpmudev_modify_uploaded_file_name', 10, 6);

    }


Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @jodyfr

    I hope you are doing well.

    I tested the full code:

    <?php
    
    add_action( 'forminator_form_before_handle_submit', 'wpmudev_uploaded_filename_fix', 10, 1 );
    add_action( 'forminator_form_before_save_entry', 'wpmudev_uploaded_filename_fix', 10, 1 );
    function wpmudev_uploaded_filename_fix( $form_id ) {
    	if ( $form_id != 655 ) { //Please change the form ID
    		return;
    	}
    
    	add_filter('wp_unique_filename', 'wpmudev_modify_uploaded_file_name', 10, 6);
    }
    
    function wpmudev_modify_uploaded_file_name( $filename, $ext, $dir, $unique_filename_callback, $alt_filenames, $number ) {	
    	$uniq_id = substr($filename, 0, 12);
    	if ( ctype_alnum( $uniq_id ) ) {
            $search = $uniq_id.'-';
    		$filename = str_replace(  $search, '', $filename );
    	}
    	
        return $filename;
    }

    Using my lab site and Forminator 1.29 but it worked well, could you please confirm which PHP version you are using, also run a full plugin conflict test https://wpmudev.com/docs/getting-started/getting-support/#conflict-test in a Staging site https://wordpress.org/plugins/wp-staging/

    Let us know the result you got.
    Best Regards
    Patrick Freitas

    Thread Starter jodyfr

    (@jodyfr)

    Hi Patrick, thanks for responding. The PHP version had been upgraded to 8.2 recently, so I put it back to 8.0, disabled all plugins except Forminator, and retested. Unfortunately, the MP3 files still are going into the temp folder with the random string at the front of the file name. Any ideas what else I can check?
    Thanks,
    Jody

    Plugin Support Kris – WPMU DEV Support

    (@wpmudevsupport13)

    Hi @jodyfr

    Just to be on the same page when it comes to your conflict test, does theme was changed also (in case your theme had update as well in past days/weeks).

    If that was done as well, please email us at: wpsupport@incsub.com
    Subject: ATTN: WPMU DEV support – wp.org

    Please send:
    – Link back to this thread for reference (https://wordpress.org/support/topic/uploaded-files-stuck-in-temp-folder-inside-upload-folder/)
    so that we could review this case more for you

    Kind Regards,
    Kris

    Plugin Support Williams – WPMU DEV Support

    (@wpmudevsupport3)

    Hi @jodyfr,

    We received your email and it has been followed.

    I’ll go and mark this thread as resolved. Note that you can still reply on this topic.

    If you have any additional questions or require further help, please let us know!

    Best regards,
    Laura

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Uploaded files stuck in /temp folder inside upload folder’ is closed to new replies.