Skip to main content
Streams a file through the Dreep API as a multipart upload. The simplest option — for very large files, or uploads that originate in a browser, use PresignUpload.

Signature

UploadOptions

Destination

Set at most one field. Setting more returns an error before any request is made. Leave all three empty and the asset lands in the project’s default folder. See Folders & Paths for how paths resolve.

Returns

A *dreep.MediaAsset:
The API sends sizeBytes as a string, because Postgres BIGINT columns serialise that way over JSON. The SDK decodes either form; call asset.SizeBytes.Int64() for the value.

Transforming on upload

Anything in Transform is applied before storage, so the transformed result is what gets stored and returned. The original is not kept.
Apply a saved preset with Transform: &dreep.Transform{Preset: "thumbnail"}. This counts against your plan’s monthly transformation quota. Transforming at delivery time with URL instead keeps the original intact and serves any number of variants from it.

Streaming large files

Upload writes the multipart body through an io.Pipe, so the file is streamed rather than read into memory. When you know the size, pass KnownSize so the request carries an exact Content-Length:
If KnownSize doesn’t match the bytes actually read, the request fails.

Errors

Uploads are never retried automatically — see Errors & Retries.