Skip Navigation

[Résolu] File Size Limit

This support ticket is created Il y a 9 années. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 -
- - - - - - -

Supporter timezone: Europe/Madrid (GMT+01:00)

This topic contains 3 réponses, has 3 voix.

Last updated by kelvinL-2 Il y a 8 années et 11 mois.

Assisted by: Caridad.


Hi, I' ve read this post here which sounds idea, however I have 4 different cred form IDs I'd like to use it with - I'm a newbie when it comes to PHP/jQuery etc - so not sure how I would change the example to work with 4 ID's rather than just the one.

Any help would be greatly appreciated.


There is another way to target a CRED form by id, with a different hook name. Lets say you have forms 20, 21, 22 & 23.


function cred_filetype_size_validation($field_data, $form_data)
    // Field data are field values and errors
    //Run the rest of code for this CRED ONLY and IF the file is upload type and size are set.
    if (isset($_FILES['wpcf-the-file-field']['type'])) && (isset($_FILES['wpcf-the-file-field']['size'])) {
        //Retrieve file type
        //Retrieve file size
        //Validate files uploaded, make sure its PDF file type AND not more than 100kB
        if (!(  ('application/pdf' == $file_type_uploaded) && ($file_size_uploaded < 100000) )) {
            //Validation failed,
            // set error message per field
            //Remove wpcf - prefix here!
            $errors['the-file-field']='Sorry the file you have uploaded is not of correct type or exceeded 100kB limit.';  
    //return result
    return array($fields,$errors);

Please let me know if you are satisfied with my reply and any other questions you may have.



Thanks Caridad, I had to put extra brackets around line 12, but that seems to work well.

I have another couple of questions regarding Cred and Types, but will add them to new posts so people can search them for future reference (I know I've found articles on this forum really helpful).




Dear Caridad,

For the script $_FILES['wpcf-the-file-field']['type'], what is the 'wpfc-the-file-field' if my field tag is "brcopy"?

Best regards,


This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.