CppCMS
|
This class holds a uploaded file, it is generally fetched via widgets::file or via http::request::files. More...
#include <cppcms/http_file.h>
Public Member Functions | |
std::string | name () const |
std::string | mime () const |
std::string | filename () const |
std::istream & | data () |
long long | size () |
void | save_to (std::string const &filename) |
Friends | |
class | request |
This class holds a uploaded file, it is generally fetched via widgets::file or via http::request::files.
It provides full information about uploaded data as it was send by browser and allows to read the file via std::istream seek-able interface or save to the file system
Note: this class does not perform any validations, for checking the data use widgets::file that allows to perform numerous checks on the file data.
std::istream& cppcms::http::file::data | ( | ) |
Get std::istream on the data, please note, you need to call data().seekg(0) when using this stream first time.
std::string cppcms::http::file::filename | ( | ) | const |
Get the filename as it was sent by the browser.
std::string cppcms::http::file::mime | ( | ) | const |
Get the content-type of the file as it was sent by the browser.
std::string cppcms::http::file::name | ( | ) | const |
Get the name of the POST field (i.e. <input name="value" ...>)
void cppcms::http::file::save_to | ( | std::string const & | filename | ) |
Save file to file named filename. Throws cppcms_error in case of failure.
Notes:
long long cppcms::http::file::size | ( | ) |
Get the size of the file.