Class: Mechanize::Form::FileUpload

Inherits:
Field
  • Object
show all
Defined in:
lib/mechanize/form/file_upload.rb

Overview

This class represents a file upload field found in a form. To use this class, set FileUpload#file_data= to the data of the file you want to upload and FileUpload#mime_type= to the appropriate mime type of the file.

See the example in EXAMPLES

Instance Attribute Summary collapse

Attributes inherited from Field

#name, #node, #type, #value

Instance Method Summary collapse

Methods inherited from Field

#<=>, #dom_class, #dom_id, #query_value

Constructor Details

#initialize(node, file_name) ⇒ FileUpload

Returns a new instance of FileUpload.



14
15
16
17
18
19
# File 'lib/mechanize/form/file_upload.rb', line 14

def initialize node, file_name
  @file_name = Mechanize::Util.html_unescape(file_name)
  @file_data = nil
  @node      = node
  super(node, @file_data)
end

Instance Attribute Details

#file_nameObject

File name



8
9
10
# File 'lib/mechanize/form/file_upload.rb', line 8

def file_name
  @file_name
end

#mime_typeObject

Mime Type (Optional)



9
10
11
# File 'lib/mechanize/form/file_upload.rb', line 9

def mime_type
  @mime_type
end