Here we discuss different approaches to providing the ability to include uploaded files in multipart POST'ed forms via RCurl.

At present, the postForm function in RCurl assumes that all the name = value pairs passed to it are simple string values. My original notion for handling the upload of forms was that the R code would know to read the contents of the specified file into an R string and pass it to postForm() directly. This is, in many ways, desirable as the "application" calling postForm knows when it is talking about a file rather than a simple piece of text. Unfortunately, however, this won't work particularly well with binary files unless we read them into R and pass the contents directly to the RCurl C code. We can use the raw type to do this. We also need to allow the caller specify the name of the file rather than just its contents. And we also need to allow the specification of the content-type. libcurl can also support The following is one interface. We create a new function named fileUpload which can be told about a filename or given the contents, the content type and the file from which it came. This puts a class on the object and when we receive one of these in the C code, we process it "approrpiately".