Forum: Ruby on Rails Getting filename of upload

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
8e01a4d029c6073279ae7287665d5550?d=identicon&s=25 DavidB (Guest)
on 2007-06-22 16:14
(Received via mailing list)
I have a method that processes an uploaded file, manages content_type,
and a few other things. How would I go about getting the filename of
the uploaded file WITHOUT using javascript on the client side to send
it through the form???

LiveHTTPHeaders sends the filename with 'Content_Disposition'. Looking
through the API of CGI.rb, I still could not find an answer on how to
capture the original filename from the client.

Thanks in advance.
66d1d0df01e4bbb82674a353ea68d6ee?d=identicon&s=25 Josh Kieschnick (jjkiesch)
on 2007-06-22 16:43
(Received via mailing list)
i believe there is an "original_filename" object that you can call on
your file object.

file_name = my_file.original_filename

hope that helps.
8e01a4d029c6073279ae7287665d5550?d=identicon&s=25 DavidB (Guest)
on 2007-06-22 17:25
(Received via mailing list)
Thanks-that is precisely what I was looking for. Next time, I will
comb the docs more carefully.

THanks again, Josh.

This topic is locked and can not be replied to.