• Resolved akaz

    (@akaz)


    Is there a max file size auto set? Or can I set one?

Viewing 1 replies (of 1 total)
  • Plugin Support vidyakv

    (@vidyakv)

    Hi @akaz,

    Thanks for reaching out to us.

    Currently, we use the WordPress Maximum Upload File Size limit. But, you can use the below code snippet in your theme’s(we recommend child theme) functions.php to limit the file size. In the code snippet, we are limiting the file size to 1 MB. Please change the value to your preferred choice.

    function awsm_application_upload_size_limit( $size ) {
    if ( is_singular( 'awsm_job_openings' ) ) {
    $size = 1 * 1024 * 1024; // 1 MB
    }
    return $size;
    }
    add_filter( 'upload_size_limit', 'awsm_application_upload_size_limit' );
    function awsm_job_application_submitting() {
    global $awsm_response;
    if ( count( $awsm_response['error'] ) === 0 && isset( $_FILES ) && count( $_FILES ) > 0 ) {
    $error = false;
    foreach ( $_FILES as $file ) {
    $limit = 1 * 1024 * 1024; // 1 MB
    if ( $file['size'] > $limit ) {
    $error = true;
    }
    }
    if ( $error ) {
    $awsm_response['error'][] = 'The file you have selected is too large';
    }
    }
    }
    add_action( 'awsm_job_application_submitting', 'awsm_job_application_submitting' ); 

    Regards,
    Vidya K V

Viewing 1 replies (of 1 total)
  • The topic ‘Max file Size’ is closed to new replies.