FileUpload
TsgcHTMLComponent_FileUpload — render a drag-and-drop file upload zone that posts files as multipart/form-data, in Delphi, C++ Builder and .NET.
TsgcHTMLComponent_FileUpload — render a drag-and-drop file upload zone that posts files as multipart/form-data, in Delphi, C++ Builder and .NET.
An upload component that emits a Bootstrap <form> with a styled drop zone, a file input and a submit button, plus its own scoped CSS. Set the action and limits, then read the HTML property.
TsgcHTMLComponent_FileUpload
Bootstrap 5 form + scoped drop-zone CSS
Delphi, C++ Builder, .NET
Set Action, Accept and the drop-zone texts, then read HTML (or drop it into a TsgcHTMLTemplate_Bootstrap page).
uses
sgcHTML_Enums, sgcHTML_Component_FileUpload;
var
oUpload: TsgcHTMLComponent_FileUpload;
begin
oUpload := TsgcHTMLComponent_FileUpload.Create(nil);
try
oUpload.Action := '/api/upload';
oUpload.Accept := 'image/*';
oUpload.MaxSize := '5 MB';
oUpload.Multiple := True;
oUpload.DragDropEnabled := True;
oUpload.ButtonText := 'Upload files';
oUpload.ButtonStyle := bsPrimary;
WebModule.Response := oUpload.HTML; // <form> drop zone + scoped CSS
finally
oUpload.Free;
end;
end;
// includes: sgcHTML_Enums.hpp, sgcHTML_Component_FileUpload.hpp
TsgcHTMLComponent_FileUpload *oUpload = new TsgcHTMLComponent_FileUpload(NULL);
try
{
oUpload->Action = "/api/upload";
oUpload->Accept = "image/*";
oUpload->MaxSize = "5 MB";
oUpload->Multiple = true;
oUpload->DragDropEnabled = true;
oUpload->ButtonText = "Upload files";
oUpload->ButtonStyle = bsPrimary;
String html = oUpload->HTML; // <form> drop zone + scoped CSS
}
__finally
{
delete oUpload;
}
using esegece.sgcWebSockets;
var upload = new TsgcHTMLComponent_FileUpload();
upload.Action = "/api/upload";
upload.Accept = "image/*";
upload.MaxSize = "5 MB";
upload.Multiple = true;
upload.DragDropEnabled = true;
upload.ButtonText = "Upload files";
upload.ButtonStyle = TsgcHTMLButtonStyle.bsPrimary;
string html = upload.HTML; // <form> drop zone + scoped CSS
The members you reach for most often.
Action sets the POST endpoint; InputName names the file field; the form always posts as multipart/form-data.
Accept filters the allowed file types; MaxSize shows a size-limit hint; Multiple lets the user pick several files at once.
DragDropEnabled toggles the styled drop area; Title, Subtitle and ButtonText set its copy.
IconHTML sets the zone icon; ButtonStyle (TsgcHTMLButtonStyle, e.g. bsPrimary) styles the submit button.
HTML returns the upload <form> and CSS returns the scoped .sgc-upload-zone styles — the page template emits both.
Inherited Section, ColumnWidth and RowGroup place the uploader on a TsgcHTMLPageBuilder grid.