Core Docs

ImageUploader

Upload image (1 hoặc nhiều) — paths lưu vào string field của entity, phân cách `;`.

Source: Core/Components/ImageUploader.cs ComponentType trong DB: Image (alias chính). Cũng dùng được ImageUploader qua reflection.

Cấu hình

ComType:    Image                 # alias chính cho ImageUploader
FieldName:  Attachments
Label:      File đính kèm
ShowLabel:  true

Field DB dùng

FieldVai trò
FieldNameProperty entity bind chuỗi paths file (string, các paths cách bởi ;).
LabelText label hiển thị.
DataSourceFilterOData filter ?$filter=... (nếu cần lookup file metadata).
EventsJSON map {"change": "OnUploaded"} để hook handler.
ChildStyleInline CSS cho thumbnail container.
IsRealtimeTrue → push update qua WebSocket khi file mới upload.
PrecisionPrecision setting (rare).
VirtualScrollTrue → virtual scroll khi nhiều file.
UpperCaseTrue → uppercase tên file display.
PlainTextTrue → text display thay vì thumbnail preview.
ComponentGroupIdSection ID chứa uploader (auto-set).
IdDOM ID (auto-set).

Events kích hoạt

EventMethod signature
change(entity)

Fire sau mỗi lần upload xong (1 file hoặc batch).

public void OnAttachmentsChanged(object entity)
{
    var inv = (Invoice)entity;
    Toast.Small("Đã upload, paths: " + inv.Attachments);
}

Behavior

  • POST file lên endpoint FTP/file → backend trả về path string.
  • Nhiều paths concat bởi ; (vd "img1.png;img2.jpg").
  • Drag & drop file vào component cũng work.
  • Click ô → mở dialog browse file.

Tip

  • Mở dialog từ code: imgUploader.OpenFileDialog(eventArg) — pattern thực DriverContainerDetailBL.cs.
  • Hiển thị thumbnail tự động cho file image; file khác render link.

Core Docs · Astro · Core.API/wwwRoot/docs