I am trying to upload a 432 KB exe file to a column in mysql that is
type blob . It can upload pdfs and rtfs and docs and but when I try to
upload even a jpg which is barely 184 kb it gives the error (data too
long) why is that? (detailed error in file) :
ActiveRecord::StatementInvalid in StoragesController#create
Mysql::Error: #22001 Data too long for column 'data' at row 1: INSERT
INTO `storages` (`content_type`, `name`, `updated_at`, `created_at`,
`data`) VALUES('image/jpeg', 'Add Task.JPG', '2008-06-25 18:32:13',
'2008-06-25 18:32:13',
x'ffd8ffe000
It looks like you might be using MySQL "BLOB" instead of "LONGBLOB"
for your binary column. Try specifying a size (large enough for your
data) in your migration using the :size => option. For more detail,
see the resolution of this ticket:
http://dev.rubyonrails.org/ticket/4164
Good luck!
- Eric Kramer, Nationwide Children's Hospital
The longblob helps to some extent ... but then I got the following error
the size of the file I attempted to upload is 6948KB and the error I got
was
ActiveRecord::StatementInvalid in StoragesController#create
Mysql::Error: Lost connection to MySQL server during query: INSERT INTO
`storages` (`content_type`, `name`, `updated_at`, `created_at`, `data`)
VALUES('application/x-sdlc', 'PrintEngine_20060519_motomail_setup.exe',
'2008-07-07 14:43:37
I am trying to upload a 432 KB exe file to a column in mysql that is
type blob . It can upload pdfs and rtfs and docs and but when I try to
upload even a jpg which is barely 184 kb it gives the error (data too
long) why is that?
Look the /db/schema.rb file. Maybe your camp is defined as string.