You need to sign in to do that
Don't have an account?

File size validation in apex
Hi team,
I have a requirement where I have VF page and when I choose a file to upload I need to validate file size and display error message if it is more size. After successful upload page should be redirected back to the parent object. I tried in apex and ended up with view state error. Please help to solve this
Thanks In advance.
I have a requirement where I have VF page and when I choose a file to upload I need to validate file size and display error message if it is more size. After successful upload page should be redirected back to the parent object. I tried in apex and ended up with view state error. Please help to solve this
Thanks In advance.
Try below code for validate file size and display error message if it is more size.
VF Page :- Apex Class :-
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi
I tried this solution and giving me view state error(max view state limit 170 kB exceeded). Can you help to resolve.
Thanks.