Logo Search packages:      
Sourcecode: poco version File versions  Download package

void Poco::Net::HTMLForm::load ( const HTTPRequest request,
std::istream &  requestBody,
PartHandler handler 
)

Adds an part/attachment (file upload) to the form.

The form takes ownership of the PartSource and deletes it when it is no longer needed.

The part will only be sent if the encoding set for the form is "multipart/form-data"

Definition at line 125 of file HTMLForm.cpp.

References ENCODING_MULTIPART, Poco::Net::HTTPMessage::getContentType(), Poco::Net::HTTPRequest::getMethod(), Poco::Net::HTTPRequest::getURI(), readUrl(), and Poco::Net::MessageHeader::splitParameters().

Referenced by HTMLForm(), and load().

{
      if (request.getMethod() == HTTPRequest::HTTP_POST)
      {
            std::string mediaType;
            NameValueCollection params;
            MessageHeader::splitParameters(request.getContentType(), mediaType, params); 
            _encoding = mediaType;
            if (_encoding == ENCODING_MULTIPART)
            {
                  _boundary = params["boundary"];
                  readMultipart(requestBody, handler);
            }
            else
            {
                  readUrl(requestBody);
            }
      }
      else
      {
            URI uri(request.getURI());
            std::istringstream istr(uri.getRawQuery());
            readUrl(istr);
      }
}


Generated by  Doxygen 1.6.0   Back to index