• Hello, please see link below for reference on the form I’m using.

    The potential customer is supposed to upload 2 separate forms or documents, but sometimes when they don’t have the second document, they upload 2 of the same ones to submit. Our company does not accept this.

    Is there a way to prevent the customer from uploading 2 of the same documents?

    Thank you,

    Maggie

    • This topic was modified 2 years, 12 months ago by Maggie.

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Maggie

    (@maggiepbi)

    Side note: If this is not possible, is there a way to prevent them from uploading the same file names? This could be a faster method. Thanks!

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    It would be possible with custom validation.

    Thread Starter Maggie

    (@maggiepbi)

    Hi Takayuki! Thanks for replying! :))

    I have just tried to implement the custom validation script but it is currently not working, please see this test page: https://pacauto.com/new-account-register-test/

    I have replaced “!=” to “=” (to invalidate duplicate file attachments).

    Form tags I am using for the file attachments:
    [file* file-1]
    [file* file-2]

    Code below:

    <script>

    add_filter( ‘wpcf7_validate_file*’, ‘custom_file_confirmation_validation_filter’, 20, 2 );

    function custom_file_confirmation_validation_filter( $result, $tag ) {
    if ( ‘file-2’ == $tag->name ) {
    $your_file_1 = isset( $_POST[‘file-1’] ) ? trim( $_POST[‘file-1’] ) : ”;
    $your_file_2 = isset( $_POST[‘file-2’] ) ? trim( $_POST[‘file-2’] ) : ”;

    if ( $your_file_1 = $your_file_2 ) {
    $result->invalidate( $tag, “Please do not submit the same file.” );
    }
    }

    return $result;
    }

    </script>

    • This reply was modified 2 years, 11 months ago by Maggie.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Is there a way to prevent same file uploads?’ is closed to new replies.