class MIME::Multipart::FormData

The FormData subtype expresses values for HTML form data submissions.


RFCs consulted during implementation:

Public Class Methods

new() click to toggle source

Returns a Multipart::FormData object with a content type of multipart/form-data.

Calls superclass method MIME::Multipart.new
# File lib/mime/composite_media.rb, line 180
def initialize
  super('form-data')
end

Public Instance Methods

add(entity, name, filename = nil) click to toggle source

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.

Calls superclass method MIME::CompositeMedia#add
# 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