fileUpload               package:RCurl               R Documentation

_S_p_e_c_i_f_y _i_n_f_o_r_m_a_t_i_o_n _a_b_o_u_t _a _f_i_l_e _t_o _u_p_l_o_a_d _i_n _a_n _H_T_T_P _r_e_q_u_e_s_t

_D_e_s_c_r_i_p_t_i_o_n:

     This function creates an object that describes all of the details
     needed to include the contents of a file in the submission of an
     HTTP request, typically a multi-part form submitted via
     'postForm'. The idea is that we want to transfer the contents of a
     file or a buffer of data within R that is not actually stored on
     the file system but is resident in the R session.  We want to be
     able to specify either the name of the file and have RCurl read
     the contents when they are needed, or alternatively specify the
     contents ourselves if it makes sense that we already have the
     contents in R, e.g. that they are dynamically generated.
     Additionally, we may need to specify the type of data in the
     file/buffer via the Content-Type field for this parameter in the
     request. This function allows us to specify either the file name
     or contents and optionally the content type.

     This is used as an element in of the 'params' argument 'postForm'
     and the native C code understands and processes objects returned
     from this function.

_U_s_a_g_e:

     fileUpload(filename = character(), contents = character(), contentType = character())

_A_r_g_u_m_e_n_t_s:

filename: the name of the file that RCurl is to pass in the form
          submission/HTTP request. If this is specified and no value
          for 'contents' is given, this has to identify a
          valid/existing file.  If 'contents' is specified, any value
          provided here is used simply to provide information about the
          provenance of the data in contents. The file need not exist.
          The path is expanded by the function, so '~' can be used. 

contents: either a character vector or a 'raw' vector giving the
          contents or data to be submitted. If this is provided,
          'filename' is not needed and not read. 

contentType: a character string (vector of length 1) giving the type of
          the content, e.g. text/plain, text/html, which helps the
          server receiving the data to interpret the contents.  If
          omitted, this is omitted from the form submission and the
          recipient left to guess. 

_V_a_l_u_e:

     An object of (S3) class 'FileUploadInfo' with fields 'filename',
     'contents' and 'contentType'.

_A_u_t_h_o_r(_s):

     Duncan Temple Lang

_R_e_f_e_r_e_n_c_e_s:

     <URL: http://curl.haxx.se>

_S_e_e _A_l_s_o:

     'postForm'

