Validating format

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.

Hello!

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

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.