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

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.

Component class

TsgcHTMLComponent_FileUpload

Renders

Bootstrap 5 form + scoped drop-zone CSS

Languages

Delphi, C++ Builder, .NET

Create it, set the target, render it

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

Key properties & methods

The members you reach for most often.

Target

Action sets the POST endpoint; InputName names the file field; the form always posts as multipart/form-data.

Constraints

Accept filters the allowed file types; MaxSize shows a size-limit hint; Multiple lets the user pick several files at once.

Drop zone

DragDropEnabled toggles the styled drop area; Title, Subtitle and ButtonText set its copy.

Appearance

IconHTML sets the zone icon; ButtonStyle (TsgcHTMLButtonStyle, e.g. bsPrimary) styles the submit button.

Output

HTML returns the upload <form> and CSS returns the scoped .sgc-upload-zone styles — the page template emits both.

Layout

Inherited Section, ColumnWidth and RowGroup place the uploader on a TsgcHTMLPageBuilder grid.

Keep exploring

All sgcHTML ComponentsBrowse the full feature matrix of 60+ components.
Download Free TrialThe 30-day trial ships the 60.HTML demo projects.
PricingSingle, Team and Site licenses with full source code.

Ready to Get Started?

Download the free trial and add drag-and-drop uploads to your Delphi, C++ Builder or .NET web app.