I am trying to parse a sqlite3 database in rails 3 (using sqlite3-ruby gem). The database to parse is coming from a file upload. Here is my controller code:
require 'fileutils'
require 'sqlite3'
tmp = params[:file_upload][:my_file]
file = params[:file_upload][:my_file].tempfile
filename = params[:file_upload][:my_file].original_filename
file = File.join("public", params[:file_upload][:my_file].original_filename)
FileUtils.cp tmp.path, filename
db = SQLite3::Database.new(filename)
So it works very well in local, but not in production (with EngineYard). I get the following error:
SQLite3::NotADatabaseException (file is encrypted or is not a database)
I do not understand why. Any help would be very appreciated, because i really don't know how to solve this thing.
Thanks