Class: MIME::Multipart::FormData
- Inherits:
-
MIME::Multipart
- Object
- MIME::Media
- CompositeMedia
- MIME::Multipart
- MIME::Multipart::FormData
- Defined in:
- lib/mime/composite_media.rb
Overview
The FormData subtype expresses values for HTML form data submissions.
RFCs consulted during implementation:
-
RFC-1867 Form-based File Upload in HTML
-
RFC-2388 Returning Values from Forms: multipart/form-data
Instance Attribute Summary
Attributes inherited from CompositeMedia
Attributes inherited from MIME::Media
Attributes included from Headers::MIME
#description, #disposition, #id, #mime_version, #transfer_encoding, #type
Instance Method Summary collapse
-
#add(entity, name, filename = nil) ⇒ Object
Add the Media object,
entity
, to the FormData object. -
#initialize ⇒ FormData
constructor
Returns a Multipart::FormData object with a content type of multipart/form-data.
Methods inherited from CompositeMedia
Methods inherited from MIME::Media
Constructor Details
#initialize ⇒ FormData
Returns a Multipart::FormData object with a content type of multipart/form-data.
180 181 182 |
# File 'lib/mime/composite_media.rb', line 180 def initialize super('form-data') end |
Instance Method Details
#add(entity, name, filename = nil) ⇒ Object
Add the Media object, entity
, to the FormData object. name
is typically an HTML input tag variable name. If the input tag is of type file, then filename
must be specified to indicate a file upload.
189 190 191 192 |
# File 'lib/mime/composite_media.rb', line 189 def add entity, name, filename = nil entity.set_disposition('form-data', 'name' => name, 'filename' => filename) super(entity) end |