How do I get an original file name from an upload using file

I am uploading a .csv file for importing into a database; however, this
file
does not need to be saved on the server. How do I get the file name of
the
original file? I know about the file_column plugin but I don’t need/want
to
save the uploaded file on the server, I just need to import it and
delete
it. Right now the file name get returned as some random temp file
name…
there has to be an easy way to do this. Thanks for any help.

This is what I currently have…
In the controller:
def upload

file_contents = params[:document][:file]
FasterCSV.parse(file_contents) do |row|
result = Source.create_from_csv_array(row)
logger.error(result.inspect) if result.kind_of?(Exception)
end
redirect_to :action => ‘update_charges’
end

In the view:

Import CSV file

<%= start_form_tag( { :action => 'upload' }, { :multipart => true } ) %> Select .CSV file
<%= file_field 'document', 'file' %> <%= submit_tag 'Upload' %> <%= end_form_tag %>


View this message in context:
http://www.nabble.com/How-do-I-get-an-original-file-name-from-an-upload-using-file_field--tf2014085.html#a5535405
Sent from the RubyOnRails Users forum at Nabble.com.

On Jul 28, 2006, at 10:11 AM, jmcopeland wrote:

I am uploading a .csv file for importing into a database; however,
this file
does not need to be saved on the server. How do I get the file name
of the
original file?

file_contents = params[:document][:file]

I guess you want file_contents.original_filename.

– fxn