Blame | Last modification | View Log | Download | RSS feed
<?xml version="1.0"?><article>Here we discuss different approaches to providingthe ability to include uploaded files inmultipart POST'ed forms via RCurl.<para/>At present, the postForm function in RCurl assumes that all the name =value pairs passed to it are simple string values. My original notionfor handling the upload of forms was that the R code would know toread the contents of the specified file into an R string and pass itto postForm() directly. This is, in many ways, desirable as the"application" calling postForm knows when it is talking about a filerather than a simple piece of text. Unfortunately, however, thiswon't work particularly well with binary files unless we read theminto R and pass the contents directly to the RCurl C code. We can usethe raw type to do this.We also need to allow the caller specify the name of the file ratherthan just its contents. And we also need to allow the specificationof the content-type.libcurl can also supportThe following is one interface. We create a new function namedfileUpload which can be told about a filename or given the contents,the content type and the file from which it came. This puts a classon the object and when we receive one of these in the C code, weprocess it "approrpiately".</article>