Just check that params[:dump][:excel_file] exists before you use it.

You could also disable the upload button by default and enable it using
javascript only if they enter a value in the field.
On Aug 8, 2012 4:26 AM, "deal bitte" <lists / ruby-forum.com> wrote:

> require 'rubygems'
>     require 'spreadsheet'
>     Spreadsheet.client_encoding = 'UTF-8'
>      workbook = Spreadsheet.open params[:dump][:excel_file]
>      sheet = workbook.worksheet 'database'
>
>
> I am getting an error if i click on upload button with no file in the
> field.
>
> --
> Posted via http://www.ruby-forum.com/.
>
>