本文整理汇总了C++中http::Request::uploadedFiles方法的典型用法代码示例。如果您正苦于以下问题:C++ Request::uploadedFiles方法的具体用法?C++ Request::uploadedFiles怎么用?C++ Request::uploadedFiles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类http::Request
的用法示例。
在下文中一共展示了Request::uploadedFiles方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleRequest
virtual void handleRequest(const Http::Request& request,
Http::Response& response) {
bool triggerUpdate = false;
std::vector<Http::UploadedFile> files;
#ifdef WT_TARGET_JAVA
static Http::UploadedFile* uploaded;
#endif
Utils::find(request.uploadedFiles(), "data", files);
if (!request.tooLarge())
if (!files.empty() || request.getParameter("data"))
triggerUpdate = true;
response.setMimeType("text/html; charset=utf-8");
response.addHeader("Expires", "Sun, 14 Jun 2020 00:00:00 GMT");
response.addHeader("Cache-Control", "max-age=315360000");
#ifndef WT_TARGET_JAVA
std::ostream& o = response.out();
#else
std::ostream o(response.out());
#endif // WT_TARGET_JAVA
o << "<!DOCTYPE html>"
"<html>\n"
"<head><script type=\"text/javascript\">\n"
"function load() { ";
if (triggerUpdate || request.tooLarge()) {
o << "if (window.parent."
<< WApplication::instance()->javaScriptClass() << ") ";
if (triggerUpdate) {
LOG_DEBUG("Resource handleRequest(): signaling uploaded");
o << "window.parent."
<< WApplication::instance()->javaScriptClass()
<< "._p_.update(null, '"
<< fileUpload_->uploaded().encodeCmd() << "', null, true);";
} else if (request.tooLarge()) {
LOG_DEBUG("Resource handleRequest(): signaling file-too-large");
o << "window.parent."
<< WApplication::instance()->javaScriptClass()
<< "._p_.update(null, '"
<< fileUpload_->fileTooLargeImpl().encodeCmd() << "', null, true);";
}
} else {
LOG_DEBUG("Resource handleRequest(): no signal");
}
o << "}\n"
"</script></head>"
"<body onload=\"load();\"></body></html>";
if (request.tooLarge())
fileUpload_->tooLargeSize_ = request.tooLarge();
else
if (!files.empty())
fileUpload_->setFiles(files);
}