11 #include <boost/lexical_cast.hpp> 16 #include <Wt/WApplication> 17 #include <Wt/WCheckBox> 18 #include <Wt/WCssDecorationStyle> 19 #include <Wt/WFileResource> 20 #include <Wt/WFileUpload> 21 #include <Wt/WProgressBar> 43 std::streamsize fsize = 0;
46 theFile.seekg(0, std::ios_base::end);
47 fsize = theFile.tellg();
52 size = boost::lexical_cast<std::wstring>(fsize) +
L" bytes";
54 size = boost::lexical_cast<std::wstring>((int)(fsize / 1024))
57 std::wstring fn =
static_cast<std::wstring
> 62 +
L"</i>) " + size,
this);
149 if (!files.empty()) {
160 for (
unsigned i = 0; i < files.size(); ++i)
182 .arg(WApplication::instance()->maximumRequestSize() / 1024));
193 std::vector<Attachment> result;
195 for (
unsigned i = 0; i <
uploadInfo_.size(); ++i) {
JSignal< ::int64_t > & fileTooLarge()
void uploaded()
Slot triggered when the WFileUpload completed an upload.
Signal< void > uploadDone_
WInteractWidget * item()
Returns the clickable part.
AttachmentEdit(Composer *composer, WContainerWidget *parent=0)
Creates an attachment edit field.
const std::string & contentType() const
WAnchor * downloadLink_
Anchor referencing the file.
Wt::Signals::connection connect(F function)
An E-mail composer widget.
Option * remove_
The option to cancel the file upload.
void suggestFileName(const Wt::WString &name, ContentDisposition disposition=ContentDisposition::Attachment)
void setSize(FontSize size)
WCheckBox * keep_
The check box to keep or discard the uploaded file.
std::vector< Attachment > attachments()
Returns the attachment.
void emit(A... args) const
void removeAttachment(AttachmentEdit *attachment)
Remove the given attachment edit.
bool setText(const WString &text)
void setFormat(const WString &format)
void setMultiple(bool multiple)
WFileUpload * upload_
The WFileUpload control.
void remove()
Slot triggered when the users wishes to remove this attachment edit.
UploadInfo(const Http::UploadedFile &f, WContainerWidget *parent=0)
bool uploadNow()
Updates the file now.
const std::vector< Http::UploadedFile > & uploadedFiles() const
void setFileTextSize(int chars)
const std::string & clientFileName() const
void fileTooLarge(::int64_t size)
Slot triggered when the WFileUpload received an oversized file.
WText * error_
The text box to display an error (empty or too big file)
void attachmentDone()
Slotcalled when an attachment has been uploaded.
void setLink(const WLink &link)
bool uploadFailed_
The state of the last upload process.
Wt::Signals::connection connect(F function)
virtual Wt::Signals::connection connect(WObject *target, WObject::Method method) override
void stealSpoolFile() const
const std::string & spoolFileName() const
std::vector< UploadInfo * > uploadInfo_
void setProgressBar(WProgressBar *progressBar)