Home

UploadLength

UploadLength is a term used in resumable file upload protocols, most prominently in the tus protocol. It denotes the total size, in bytes, of the file to be uploaded. The Upload-Length value is provided by the client during the creation of the upload resource, typically in a header named Upload-Length on the initial request to the upload endpoint.

In a typical tus workflow, the client first creates an upload resource by sending a POST request

There are optional extensions in the protocol. For example, Upload-Metadata can accompany the creation request to

Use of UploadLength enables reliable pause-and-resume uploads, improves error recovery, and helps servers manage resources. It

with
Upload-Length
indicating
the
final
file
size.
The
server
responds
with
a
URL
for
the
new
upload
resource.
The
client
then
uploads
data
in
chunks
using
PATCH
requests
to
that
URL,
including
a
header
called
Upload-Offset
to
indicate
how
many
bytes
have
already
been
received.
The
server
responds
with
the
updated
offset,
and
the
process
continues
until
the
uploaded
offset
matches
the
declared
Upload-Length,
signaling
completion.
The
Upload-Length
is
used
by
the
server
to
enforce
size
limits,
allocate
storage,
and
validate
progress.
carry
information
such
as
the
filename
or
file
type,
encoded
as
metadata.
Some
implementations
support
deferring
the
length
when
the
exact
size
is
unknown
at
the
outset;
in
such
cases,
the
client
may
omit
Upload-Length
or
use
an
extension
header
to
indicate
deferral,
with
the
final
length
established
later
in
the
upload.
is,
however,
specific
to
the
protocol
in
use
and
may
have
variations
or
optional
extensions
across
implementations.