Am trying to allow files to be uploaded by having extensions of .xls
and .xlsx
. So, in the file selection window it must allow only files with these extension.
Using the below code for doing file upload in Rails
<%= form_for @book, :url => book_path, :method => :post do |f| %>
<div class="file_input" id="import">
<%= f.file_field(:excel_file) %>
</div>
<% end %>
So, how do i allow files only with these (.xls, .xlsx) extensions ?