14 #include <Wt/WAnchor.h> 15 #include <Wt/WApplication.h> 16 #include <Wt/WCheckBox.h> 17 #include <Wt/WCssDecorationStyle.h> 18 #include <Wt/WFileResource.h> 20 #include <Wt/WFileUpload.h> 21 #include <Wt/WProgressBar.h> 42 std::streamsize fsize = 0;
45 theFile.seekg(0, std::ios_base::end);
46 fsize = theFile.tellg();
51 size =
WString(std::to_string(fsize)) +
U" bytes";
53 size =
WString(std::to_string((
int)(fsize / 1024)))
56 std::u32string fn =
static_cast<std::u32string
> 84 std::unique_ptr<WProgressBar> progress = cpp14::make_unique<WProgressBar>();
85 progress->setFormat(WString::Empty);
86 progress->setVerticalAlignment(AlignmentFlag::Middle);
146 if (!files.empty()) {
156 for (
unsigned i = 0; i < files.size(); ++i) {
180 .arg(WApplication::instance()->maximumRequestSize() / 1024));
191 std::vector<Attachment> result;
193 for (
unsigned i = 0; i <
uploadInfo_.size(); ++i) {
const std::string & spoolFileName() const
void uploaded()
Slot triggered when the WFileUpload completed an upload.
WInteractWidget * item()
Returns the clickable part.
UploadInfo(const Http::UploadedFile &f)
WAnchor * downloadLink_
Anchor referencing the file.
An E-mail composer widget.
void emit(A...args) const
JSignal<::int64_t > & fileTooLarge()
Option * remove_
The option to cancel the file upload.
void setSize(FontSize size)
WCheckBox * keep_
The check box to keep or discard the uploaded file.
const std::string & contentType() const
std::vector< Attachment > attachments()
Returns the attachment.
void removeAttachment(AttachmentEdit *attachment)
Remove the given attachment edit.
bool setText(const WString &text)
Wt::Signals::connection connect(const F &function)
void setMultiple(bool multiple)
WFileUpload * upload_
The WFileUpload control.
void remove()
Slot triggered when the users wishes to remove this attachment edit.
const std::vector< Http::UploadedFile > & uploadedFiles() const
const std::string & clientFileName() const
bool uploadNow()
Updates the file now.
void setFileTextSize(int chars)
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)
AttachmentEdit(Composer *composer)
Creates an attachment edit field.
void attachmentDone()
Slotcalled when an attachment has been uploaded.
Wt::Signals::connection connect(const F &function)
void setLink(const WLink &link)
bool uploadFailed_
The state of the last upload process.
virtual Wt::Signals::connection connect(WObject *target, WObject::Method method) override
void stealSpoolFile() const
std::vector< UploadInfo * > uploadInfo_
void setProgressBar(WProgressBar *progressBar)