44# include <sys/utsname.h>
60 cout <<
"<form method=\"post\" action=\""
61 <<
cgi.getEnvironment().getScriptName()
62 <<
"\" enctype=\"multipart/form-data\">" <<
endl;
66 cout <<
"<tr><td class=\"title\">Send a file</td>"
67 <<
"<td class=\"form\">"
68 <<
"<input type=\"file\" name=\"userfile\" accept=\"text/plain\" />"
69 <<
"</td></tr>" <<
endl;
71 cout <<
"<tr><td class=\"title\">Upload Redirection</td>"
72 <<
"<td class=\"form\">"
73 <<
"<input type=\"checkbox\" name=\"redirect\" />"
74 <<
"Bounce uploaded file back to browser"
75 <<
"</td></tr>" <<
endl;
79 cout <<
"<div class=\"center\"><p>"
80 <<
"<input type=\"submit\" name=\"submit\" value=\"Send the file\" />"
81 <<
"<input type=\"reset\" value=\"Nevermind\" />"
82 <<
"</p></div></form>" <<
endl;
100 if(
cgi.queryCheckbox(
"redirect")) {
104 if(
file !=
cgi.getFiles().end()) {
126 <<
" File Upload Test" <<
title() <<
endl;
134 <<
" v"<<
cgi.getVersion() <<
" File Upload Test"
141 cout <<
comment() <<
"This page generated by cgicc for "
143 cout <<
h4() <<
"Thanks for using cgi" <<
span(
"cc").
set(
"class",
"red")
144 <<
", " <<
env.getRemoteHost()
145 <<
'(' <<
env.getRemoteAddr() <<
")!" <<
h4() <<
endl;
149 file =
cgi.getFile(
"userfile");
151 if(
file !=
cgi.getFiles().end()) {
158 cout <<
tr() <<
td(
"Data Type").
set(
"class",
"title")
161 cout <<
tr() <<
td(
"Filename").
set(
"class",
"title")
164 cout <<
tr() <<
td(
"Data Length").
set(
"class",
"title")
165 <<
td().
set(
"class",
"data") <<
file->getDataLength()
168 cout <<
tr() <<
td(
"File Data").
set(
"class",
"title")
169 <<
td().
set(
"class",
"data") <<
pre();
183 cout <<
"GNU cgi" <<
span(
"cc").
set(
"class",
"red") <<
" v";
185 cout <<
"Compiled at " <<
cgi.getCompileTime();
188 cout <<
"Configured for " <<
cgi.getHost();
192 cout <<
". Running on " <<
info.sysname;
193 cout <<
' ' <<
info.release <<
" (";
204 long us = ((
end.tv_sec -
start.tv_sec) * 1000000)
207 cout <<
br() <<
"Total time for request = " <<
us <<
" us";
208 cout <<
" (" <<
static_cast<double>(
us/1000000.0) <<
" s)";
220 catch(
const std::exception&
e) {
227 html::reset(); head::reset(); body::reset();
228 title::reset(); h1::reset(); h4::reset();
230 table::reset(); cgicc::div::reset(); p::reset();
231 a::reset(); h2::reset(); colgroup::reset();
243 cout <<
"body { color: black; background-color: white; }" <<
endl;
244 cout <<
"hr.half { width: 60%; align: center; }" <<
endl;
245 cout <<
"span.red, strong.red { color: red; }" <<
endl;
246 cout <<
"div.notice { border: solid thin; padding: 1em; margin: 1em 0; "
247 <<
"background: #ddd; }" <<
endl;
257 <<
" caught an exception" <<
h1() <<
endl;
Platform and operating system specific macro definitions.
The main header file for the GNU cgicc library.
The header file containing HTML output classes.
Class encapsulating the CGI runtime environment.
The main class of the GNU cgicc library.
Template for concrete atomic HTMLElement subclasses.
HTMLAtomicElement()
Create a new empty atomic element.
virtual const char * getName() const
Get the name of this element.
static void reset()
Reset the state of this boolean element to closed.
Specifies the DTD of the HTML 4 document.
HTMLElement & set(const std::string &name)
Set an HTMLAttribute on this HTMLElement.
The namespace containing the cgicc library.
std::vector< FormFile >::const_iterator const_file_iterator
A vector of const FormFile objects.
HTMLAttributeList set(const std::string &name)
Create a new HTMLAttributeList, and set an HTMLAttribute.