WireUpload class

Saves uploads of single or multiple files, saving them to the destination path.

If the destination path does not exist, it will be created.


Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the WireUpload class also inherits all the methods and properties of: Wire.

Show class?     Show args?       Only hookable?    

Common

NameReturnSummary 
WireUpload::error($text)
Wire WireUpload

Record an error message

 
WireUpload::execute()
array

Execute/process the upload

 
WireUpload::getCompletedFilenames()
array

Get array of uploaded filenames

 
WireUpload::getErrors()
array

Get error messages

 
WireUpload::getOriginalFilenames()
array

Get unsanitized array of original filenames (basenames) indexed by completed basename

 
WireUpload::getOverwrittenFiles()
array

Get files that were overwritten (for overwrite mode only)

 
WireUpload::isAjaxUploading()
bool

Is an ajax upload request currently in progress?

 
WireUpload::setAllowAjax()
$this

Set whether or not AJAX uploads are allowed

 
WireUpload::setDestinationPath(string $destinationPath)
$this

Set the destination path for uploaded files

 
WireUpload::setExtractArchives()
$this

Set whether or not ZIP files may be extracted

 
WireUpload::setLowercase()
$this

Set whether or not lowercase is enforced

 
WireUpload::setMaxFileSize(int $bytes)
$this

Set the max allowed uploaded file size

 
WireUpload::setMaxFiles(int $maxFiles)
$this

Set the max allowed number of uploaded files

 
WireUpload::setName(string $name)
$this

Set the upload field name (same as that provided to the constructor)

 
WireUpload::setOverwrite(bool $overwrite)
$this

Set whether or not overwrite is allowed

 
WireUpload::setOverwriteFilename(string $filename)
$this

Set the filename that may be overwritten (i.e. myphoto.jpg) for single uploads only

 
WireUpload::setTargetFilename($filename)
None

Set the target filename, only useful for single uploads

 
WireUpload::setValidExtensions(array $extensions)
$this

Set allowed file extensions

 
WireUpload::validateFilename(string $value)
bool string

Sanitize/validate a given filename

 
WireUpload::wired()
None

Wired to API

 

Additional methods and properties

In addition to the methods and properties above, WireUpload also inherits the methods and properties of these classes:

API reference based on ProcessWire core version 3.0.252