Apache::Upload
A class that provides an interface for accessing files uploaded by the client. This class is only available when mod_ruby is compiled with the Generic Apache Request Library (libapreq).
Superclass
Object
Methods
filename- Returns the name of the uploaded file as reported by the client.
info- Returns the header information for the uploaded file as an Apache::Table object.
io-
Returns a new IO object opened (readonly) to the temporary file associated with the upload. Alias:
fp.Example:
upload = req.uploads['the-file'] tempfile = upload.io destfile = File::open( "/some/where/thefile.txt", File::WRONLY ) {|safefile| tempfile.each {|line| safefile.print(line) } } name- Returns the name of the upload field.
size- Returns the size of the uploaded file in bytes.
tempname- Returns the name of the spool file containing the uploaded data on the server.
type-
Returns the file's MIME content type. This is a shortcut for accessing the uploaded file's 'Content-Type' header:
upload = req.uploads['the-file'] upload.info['content-type'] == upload.type
Apache::Table
A class to wrap table data type.
Superclass
Object
Included Classes
Enumerable
Methods
clear- Clears contents of the table.
self[name]get(name)- Returns the value of name.
self[name]= valset(name, val)setn(name, val)merge(name, val)mergen(name, val)add(name, val)addn(name, val)- Sets the value of name to val.
unset(name)- Unsets the value of name.
each {|key,val|...}each_key {|key|...}each_value {|val|...}- Iterates over each element.
Keyword(s):
References:[ClassReferenceManual] [Apache::Request]