• Resolved aicoosoft

    (@aicoosoft)


    Great plugin, I want to know, how to rename the uploaded file name? For example, it is allowed to use the md5sum of the file as the file name, will it be more flexible?

    • This topic was modified 3 years ago by aicoosoft.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Kris – WPMU DEV Support

    (@wpmudevsupport13)

    Hi @aicoosoft

    I hope you are doing good today.

    I pinged our SLS and Forminator Team what will be possible in this case. We will post an update here as soon as more information is available.

    Kind Regards,
    Kris

    Plugin Support Kris – WPMU DEV Support

    (@wpmudevsupport13)

    Hi again @aicoosoft

    For PHP there’s md5_file. Could you clarify in what terms this needs to be more flexible?

    Kind Regards,
    Kris

    Thread Starter aicoosoft

    (@aicoosoft)

    Hi there

    Thanks for the response, of course we can do that, but as a form as a whole, it is very flexible to provide this option.
    For example, if the same files are uploaded by anonymous users, they will all be saved in the directory with userid /0/, and other programs will not know which user uploaded the file when they are going to process it. Of course, if you can use cookies for map, it will be more convenient to use.

    Here, I will mention another small requirement. It will be more convenient to use if the form can support other api interfaces of webhook after the form submission is completed, so that other background programs can continue to process the submitted file content.

    thanks

    • This reply was modified 2 years, 12 months ago by aicoosoft.
    Plugin Support Dimitris – WPMU DEV Support

    (@wpmudev-support6)

    Hello @aicoosoft

    For using MD5 you can use a filter like the following:

    <?php
    add_filter(
    	'wp_unique_filename',
    	function( $file_name, $ext, $dir, $cb, $alt, $no ) {
    		if ( isset( $_POST[ 'action' ] ) && 'forminator_submit_form_custom-forms' === $_POST[ 'action' ] ) {
    			$file_name = md5( basename( $file_name, $ext ) ) . $ext;
    		}
    
    		return $file_name;
    	},
    	10,
    	6
    );

    if the same files are uploaded by anonymous users, they will all be saved in the directory with userid /0/

    Are you using any custom snippet for that or is this a use-case you want to cover?

    Here, I will mention another small requirement. It will be more convenient to use if the form can support other api interfaces of webhook after the form submission is completed,

    We have a few sample cases on this in our Gists, a recent one: https://gist.github.com/wpmudev-sls/fa306bda0cb868fd9c7c1634b7306091

    Warm regards,
    Dimitris

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @aicoosoft

    I hope you are doing well and safe!

    We haven’t heard from you in a while, I’ll mark this thread as resolved.

    Feel free to let us know if you have any additional questions or problems.

    Best Regards
    Patrick Freitas

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘rename uploaded file name’ is closed to new replies.