Skip to content
scalive
Menu
ConnectingLiveReconnectingOffline
GitHub
c

LiveUploadDef

class LiveUploadDef[Result]

Immutable definition of a named upload.

Keep one stable definition value and reuse it with upload context operations. Runtime matching uses the destination's identity rather than structural equality, so recreating an otherwise identical definition may not match an upload that is already allowed.

name must be non-empty; numeric limits must be positive; and chunkTimeout must be positive and at most Int.MaxValue milliseconds. Eager factory methods throw on invalid values, while validated returns the validation error. Protocol encoding truncates fractional milliseconds, so a positive timeout below one millisecond is sent as zero.

Type parameters

Result

the result produced by each completed entry

Parameters

name

stable upload name used by the form input and runtime; it is validated but not trimmed

accept

browser selection and preflight policy, not a content-security check

maxEntries

positive maximum number of entries accepted as valid during preflight, defaulting to 1; excess selections may remain visible as invalid entries

maxFileSize

positive per-entry limit in bytes, defaulting to 8,000,000; initially checked against client-reported metadata

chunkSize

positive requested browser chunk size in bytes, defaulting to 64,000

chunkTimeout

positive browser chunk timeout, defaulting to 10 seconds and encoded with chunkTimeout.toMillis.toInt

autoUpload

whether valid entries start uploading without a form submit, defaulting to false

progress

optional callback for accepted browser progress reports, defaulting to none

maxEntriesMode

whether only selected entries or all entries seen during this allowed lifecycle count toward maxEntries, defaulting to Selected

validator

optional validation of untrusted browser metadata; returning a reason rejects the entry

Exported from scalive.upload.LiveUploadDef. View source (scalive/api/src/scalive/upload/LiveUpload.scala:773-798)

Values10

accept

val accept: LiveUploadAccept

Browser selection and preflight policy, not a content-security check.

Exported from scalive.upload.LiveUploadDef.accept. View source (scalive/api/src/scalive/upload/LiveUpload.scala:775-775)

autoUpload

val autoUpload: Boolean

Whether valid entries start uploading without a form submit, defaulting to false.

Exported from scalive.upload.LiveUploadDef.autoUpload. View source (scalive/api/src/scalive/upload/LiveUpload.scala:780-780)

chunkSize

val chunkSize: Int

Positive requested browser chunk size in bytes, defaulting to 64,000.

Exported from scalive.upload.LiveUploadDef.chunkSize. View source (scalive/api/src/scalive/upload/LiveUpload.scala:778-778)

chunkTimeout

val chunkTimeout: zio.package.Duration

Positive browser chunk timeout, defaulting to 10 seconds and encoded with chunkTimeout.toMillis.toInt.

Exported from scalive.upload.LiveUploadDef.chunkTimeout. View source (scalive/api/src/scalive/upload/LiveUpload.scala:779-779)

maxEntries

val maxEntries: Int

Positive maximum number of entries accepted as valid during preflight, defaulting to 1; excess selections may remain visible as invalid entries.

Exported from scalive.upload.LiveUploadDef.maxEntries. View source (scalive/api/src/scalive/upload/LiveUpload.scala:776-776)

maxEntriesMode

val maxEntriesMode: LiveUploadMaxEntriesMode

Whether only selected entries or all entries seen during this allowed lifecycle count toward maxEntries, defaulting to Selected.

Exported from scalive.upload.LiveUploadDef.maxEntriesMode. View source (scalive/api/src/scalive/upload/LiveUpload.scala:782-782)

maxFileSize

val maxFileSize: Long

Positive per-entry limit in bytes, defaulting to 8,000,000; initially checked against client-reported metadata.

Exported from scalive.upload.LiveUploadDef.maxFileSize. View source (scalive/api/src/scalive/upload/LiveUpload.scala:777-777)

name

val name: String

Stable upload name used by the form input and runtime; it is validated but not trimmed.

Exported from scalive.upload.LiveUploadDef.name. View source (scalive/api/src/scalive/upload/LiveUpload.scala:774-774)

progress

val progress: Option[LiveUploadProgress[Result]]

Optional callback for accepted browser progress reports, defaulting to none.

Exported from scalive.upload.LiveUploadDef.progress. View source (scalive/api/src/scalive/upload/LiveUpload.scala:781-781)

validator

val validator: Option[UploadClientMetadata => Option[String]]

Optional validation of untrusted browser metadata; returning a reason rejects the entry.

Exported from scalive.upload.LiveUploadDef.validator. View source (scalive/api/src/scalive/upload/LiveUpload.scala:783-783)