Colin Law wrote: > On 20 July 2010 14:32, Hemant Bhargava <[email protected]> wrote: >> >> Hello Guys, >> 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?
Just like as if File.size(params[:upload_resume]) > 1mb redirect_to :back with some flash[:notice] end The only problem with this is that i am unable to retain the form values after redirecting. > > Colin -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

