Barracuda Application Server C/C++ Reference
MultipartUpload Struct Reference

Detailed Description

The MultipartUpload, which is an abstract base class, implements the functionality as specified in RFC 1867.

A HTTP POST in multipart mode uses a rather complex scheme for transferring data, and we do not recommend using this class unless you use a browser for uploading data or need to send a stream of binary files and application/x-www-form-urlencoded data to the server. Transferring files from a client to the server is easier with HTTP PUT, but a browser can, unfortunately, not upload data using HTTP PUT.

You must subclass the MultipartUpload class and implement a number of 'onEvent' callback methods. The 'onEvent' methods are called as the MultipartUpload decodes the stream of data uploaded from the client.

The MultipartUpload class is designed such that any error detected in the 'onEvent' methods must make sure the MultipartUpload destructor or call MultipartUpload::getCon is called before returning a non-zero value. You may also have to release the memory associated with the MultipartUpload instance – i.e. with the instance of the class sub-classing MultipartUpload. The MultipartUpload class is designed such that it allows the callback to destroy the object itself; that is, the MultipartUpload logic makes sure no data, except for stack variables, are used when the callback returns an error code.

#include <MultipartUpload.h>

Public Member Functions

 MultipartUpload (HttpServer *server, MultipartUpload_EndOfReq onEndOfReq, MultipartUpload_FormData onFormData, MultipartUpload_FileBegin onFileBegin, MultipartUpload_FileData onFileData, MultipartUpload_Error onError, U32 bufferSize, AllocatorIntf *allocator=0)
 ~MultipartUpload ()
 Release buffers used during parsing the multipart stream.
int start (HttpRequest *req)
 Start receiving data asynchronously. More...
HttpConnectiongetCon (MultipartUpload *o)
 Returns the internal active connection object. More...
HttpServergetServer ()
 Get the HttpServer instance.