Data Types

UploadedFile

Represents a file successfully uploaded by the Upload Widget or the Upload JavaScript SDK.

Structure

{
"accountId": String,
"file": Object,
"filePath": String,
"fileUrl": String,
"lastModified": Integer,
"mime": String,
"originalFileName": String | Null,
"size": Integer,
"tags": String[]
}

Example

{
"accountId": "YOUR_ACCOUNT_ID",
"filePath": "/uploads/image.jpg",
"fileUrl": "https://upcdn.io/A623uY2/raw/uploads/image.jpg",
"lastModified": 1615680311115,
"metadata": {
"myCustomField1": true,
"myCustomField2": {
"hello": "world"
},
"anotherCustomField": 42
},
"mime": "image/jpeg",
"originalFileName": "example.jpg",
"size": 43182,
"tags": [
"images/profile"
]
}

Properties

accountId

Your account ID.

This is visible on the settings page:

https://upload.io/dashboard/settings

Type: String

Length: 7

Example: "A623uY2"

Required: Yes

file

File object from the DOM (i.e. from the input's onchange event).

Required: Yes

filePath

The file's path.

We recommend you save this value to your database (instead of the file's URL).

This value always begins with a /.

Type: String

Min Length: 1

Max Length: 512

Example: "/uploads/image.jpg"

Required: Yes

fileUrl

The file's raw URL (i.e. with no file transformations applied).

Type: String

Min Length: 1

Max Length: 255

Example: "https://upcdn.io/A623uY2/raw/uploads/image.jpg"

Required: Yes

lastModified

Time the file was uploaded or last overwritten. Epoch milliseconds (since midnight 1 January 1970, UTC).

Type: Integer

Minimum: 0

Example: 1615680311115

Required: Yes

metadata

The file metadata specified in the original upload request as a JSON object.

Type: FileMetadata

Required: Yes

mime

File MIME type.

Type: String

Min Length: 3

Max Length: 255

Example: "image/jpeg"

Required: Yes

originalFileName

The file's original name on the user's device.

Type: String | Null

Min Length: 1

Max Length: 255

Example: "example.jpg"

Required: Yes

size

The size of the file in bytes.

Type: Integer

Minimum: 0

Example: 43182

Required: Yes

tags

The tags you specify here determine which rules will be executed for the upload.

You create rules in the Upload Dashboard, and choose which tags trigger each rule.

Rules include: max file size checks, traffic limit checks, rate limit checks, etc.

Type: String[]

Example: ["images/profile"]

Required: Yes

Used by

Was this section helpful? Yes No

You are using an outdated browser.

This website requires a modern web browser -- the latest versions of these browsers are supported: