Vue Upload Files Core




The set of core attributes in the file object.

All files from the $upload.files() queues contain the following meta data for quick reference.

$id

For reference and to key in loops.

$file

Reference to raw file object from browser.

$instance

The instance of the named upload object.

$raw

A raw base64 format for the data useful for image previews.

This will be null until the files preview() method is called since it can take a while to load up.

name

The name of the file.

size

The size of the file.

type

The mime type of the file.

extension

Extension of the file from filename then mime-type based on what is available.

state

Current state of the file.

Could be one of the following: queue, progress, upload, error or success.

percentComplete

Percent progress indicator for the file as an integer (0 to 100);

errors

Errors from file.

The internal default format is: [{code: 'somecode', msg: 'There was an error.''}]

Errors can come internally from the module itself or externally from an error on the server end.

Use parseErrors option when installing the plugin to format errors from the server.

preview

Function to generate a raw format of the file useful for image previews.

This is useful when setting a local preview of the file before starting an upload.

<img 
    :src="$upload.file().$raw || $auth.user().avatar"
/>

clear

Completely removes the file from the queue.