Skip Navigation

[Resolved] Limit multiple image upload size into CRED form

This thread is resolved. Here is a description of the problem and solution.

Problem:
I have a CRED module in which the user can upload photos. I would like to limit the size of each file to 5 MB and also the format. How can I do this?
Solution:
To apply validation on the uploaded file's type and size, you can use the "cred_form_validate" hook:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_form_validate

You'll find a good example of this hook's usage in this reply:
https://toolset.com/forums/topic/restricting-file-size-and-types-on-file-upload-cred-form/#post-1411409
Relevant Documentation:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_form_validate

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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Sao_Paulo (GMT-03:00)

This topic contains 1 reply, has 2 voices.

Last updated by Mateus Getulio 8 months, 3 weeks ago.

Assisted by: Mateus Getulio.

Author
Posts
#2690771

Hi,
I have a CRED module in which the user can upload photos. I would like to limit the size of each file to 5 MB and also the format. How can I do this?
Regards

#2690825

Mateus Getulio
Supporter

Languages: English (English )

Timezone: America/Sao_Paulo (GMT-03:00)

Hi,

Thank you for contacting us and I'd be happy to assist.

To apply validation on the uploaded file's type and size, you can use the "cred_form_validate" hook:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_form_validate

You'll find a good example of this hook's usage in this reply:
https://toolset.com/forums/topic/restricting-file-size-and-types-on-file-upload-cred-form/#post-1411409

I hope this helps and please let me know if you need any further assistance around this.

Best regards,
Mateus