drogon
C++14/17-based HTTP application framework
Loading...
Searching...
No Matches
drogon::UploadFile Class Reference

#include <drogon/UploadFile.h>

Public Member Functions

 UploadFile (const std::string &filePath, const std::string &fileName="", const std::string &itemName="file", ContentType contentType=CT_NONE)
 Constructor.
 UploadFile (const void *data, const size_t len, const std::string &fileName="memory.bin", const std::string &itemName="file", ContentType contentType=CT_APPLICATION_OCTET_STREAM)
 Constructor.
const std::string & path () const
const std::string & fileName () const
const std::string & itemName () const
ContentType contentType () const
const void * data () const
size_t dataLength () const

Detailed Description

This class represents an upload file which will be transferred to the server via the multipart/form-data format

Constructor & Destructor Documentation

◆ UploadFile() [1/2]

drogon::UploadFile::UploadFile ( const std::string & filePath,
const std::string & fileName = "",
const std::string & itemName = "file",
ContentType contentType = CT_NONE )
inlineexplicit

Constructor.

Parameters
filePathThe file location on local host, including file name.
fileNameThe file name provided to the server. If it is empty by default, the file name in the filePath is provided to the server.
itemNameThe item name on the browser form.
contentTypeThe Mime content type for the part

◆ UploadFile() [2/2]

drogon::UploadFile::UploadFile ( const void * data,
const size_t len,
const std::string & fileName = "memory.bin",
const std::string & itemName = "file",
ContentType contentType = CT_APPLICATION_OCTET_STREAM )
inlineexplicit

Constructor.

Parameters
dataPointer to the data
lenData length in bytes
fileNameThe file name provided to the server.
itemNameThe item name on the browser form.
contentTypeThe Mime content type for the part

The documentation for this class was generated from the following file: