From: Jonan Scheffler Date: 2012-08-09T00:06:33+09:00 Subject: Re: file upload without entering the file --20cf30334a73c581c104c6c27421 Content-Type: text/plain; charset=ISO-8859-1 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" 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/. > > --20cf30334a73c581c104c6c27421 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

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" &= lt;lists@ruby-forum.com> wro= te:
require 'rubygems'
=A0 =A0 require 'spreadsheet'
=A0 =A0 Spreadsheet.client_encoding =3D 'UTF-8'
=A0 =A0 =A0workbook =3D Spreadsheet.open params[:dump][:excel_file]
=A0 =A0 =A0sheet =3D 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/.

--20cf30334a73c581c104c6c27421--