Method: Wpxf::Utility::BodyBuilder#add_file_from_string

Defined in:
lib/wpxf/utility/body_builder.rb

#add_file_from_string(name, value, remote_name) ⇒ Hash

Add a file to the field list that will upload a specific string as its file contents, rather than reading from disk.

Parameters:

  • name

    the name of the form item.

  • value

    the contents of the file.

  • remote_name

    the file name to transmit the file as.

Returns:

  • (Hash)

    the newly added form item.



38
39
40
41
42
43
44
# File 'lib/wpxf/utility/body_builder.rb', line 38

def add_file_from_string(name, value, remote_name)
  @fields[name] = {
    type: :mem_file,
    value: value,
    remote_name: remote_name
  }
end