Class Upload
Upload class
Provides functions for uploading files and images
Methods summary
public static
|
#
file( array $file, string $move = [], array $allowedFiletypes = ['csv'], array $max_size = 10485760, integer $parseExtension = false , boolean $parseExtension,… )
Upload file
Parameters
- $file
- $parameters The request parameters.
- $move
- $index The paramatern index for example 'file'.
- $allowedFiletypes
$move If $move is set (Is not (null or == array() or false ))
then the uploaded file will be moved to the specified directory.
The $move takes indexes 'path' and 'name', the path is the directory
the uploaded file will be moved. The name is optional and
- $max_size
- $allowedFiletypes *[Optional] Array with allowed extensions.
- $parseExtension
$max_size *[Optional] The maximum size of the
uploaded file in bytes. Default value is 10485760 bytes
- $parseExtension,…
*[Optional] If true the destination
filename will be joined with files extension Default value is false
|
public static
Array|String
|
#
image( Object $file, array $move = [], array $sizes = [], integer $maxFileSize = 2097152, array $allowedFiletypes = [ 'jpg', 'gif', 'png', 'jpeg' ] )
Upload image
Parameters
- $file
- Reference to uploaded file
- $move
Move is an array with two indexes,
path is required and it points the path be stored,
name is optional and it tells the file name to be stored if not set if
will be copied from original upload file name
- $sizes
- Is an indexed array
- $maxFileSize
- Maximum file size, Optional by default it's 2MB
- $allowedFiletypes
Array with allowed image extensions,
Optional by default it's 'jpg', 'gif', 'png', 'jpeg'
Returns
Array|String If return is not array then it's an error Message,
If it's array then every index of the requested Sizes parameter containts the file path of the specific size
|
public static
|
#
createZip( $destination, $files = [], $blobs = [], $overwrite = true )
Create a zip archive
Parameters
- $destination
- Zip archive path
- $files
- array( array( 'filename' => .. 'path' => .. ) )
- $blobs
- array( array( 'filename' => .. 'contents' => .. ) )
- $overwrite
Todo
update zip class namespace
|