Original_filename - where documented?


#1

This one is probably obvious to everyone but me.

In a file upload, I know of the “original_filename” method. I’m also
assuming there are other similar methods related to the uploaded file.
Where in heaven’s name are these documented? I’ve looked in the rails
documentation and in the ruby documentation.

Would someone be so kind as to point me at where in the documentaion
this and related methods are documented?

Thanks much
—Michael


#2

This one is probably obvious to everyone but me.

In a file upload, I know of the “original_filename” method. I’m also
assuming there are other similar methods related to the uploaded file.
Where in heaven’s name are these documented? I’ve looked in the rails
documentation and in the ruby documentation.

Would someone be so kind as to point me at where in the documentaion
this and related methods are documented?

Look in the stdlib docs under CGI (then click the CGI class link)…

If a requests method is POST and its content type is
multipart/form-data,
then it may contain uploaded files. These are stored by the
QueryExtension
module in the parameters of the request. The parameter name is the name
attribute of the file input field, as usual. However, the value is not a
string, but an IO object, either an IOString for small files, or a
Tempfile for larger ones. This object also has the additional singleton
methods:

local_path(): the path of the uploaded file on the local filesystem
original_filename(): the name of the file on the client computer
content_type(): the content type of the file