Forum: Ruby on Rails Validating format

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
NN (Guest)
on 2006-04-25 11:46
Hi there,

I am trying to upload a file and that is being done successfully.
Now I want to restrict the uploading i.e. make it only doc/pdf upload.
If anybody could help as how can I make that happen.
The file is a part of my table and its called file_name.
Thanks in advance.
Jakub Kozisek (Guest)
on 2006-04-25 16:21
Hello!

You can use validates_format_of in your model. Look at:
http://www.db75.com/new_blog/?p=150
http://www.jroller.com/page/bloritsch?entry=saving...

JK

NN wrote:
> Hi there,
>
> I am trying to upload a file and that is being done successfully.
> Now I want to restrict the uploading i.e. make it only doc/pdf upload.
> If anybody could help as how can I make that happen.
> The file is a part of my table and its called file_name.
> Thanks in advance.
This topic is locked and can not be replied to.