Validating format


#1

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.


#2

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_images_to_the_database

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.