Colin Law wrote:
How to give validation on a field which is not a database column. I mean
i am having a file field(upload_resume) in my views. So i want to give
validation on it that size should be less then 1mb. I tried
self.upload_resume and params[:upload_resume] but both are not working.
Are you trying to check the file size before or after the upload?
Thanks for your replies.
Yes i want to check the size of file before upload only. I mean first i
am checking that file had valid attributes or not. If it has then upload
it else dont.
Currenly i am doing this in controllers but for cleaner code i want to
do it in models with validations.
How are you checking the file attributes in the controller?