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.
88617b8c1550757f36cb71304b3d7d43?d=identicon&s=25 NN (Guest)
on 2006-04-25 09: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.
C07962faa904d29a147bbcedbdac1da5?d=identicon&s=25 Jakub Kozisek (Guest)
on 2006-04-25 14: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.