Slimore
  • Namespace
  • Class

Namespaces

  • None
  • Slimore
    • Cache
      • Exception
    • Captcha
    • Database
    • Debug
    • Http
    • Image
    • Log
    • Middleware
    • Mvc
    • Pagination
    • Upload

Classes

  • Uploader

Exceptions

  • Exception

Class Uploader

Class Uploader

Namespace: Slimore\Upload
Package: Slimore\Upload
Author: Pandao
Located at Slimore/Upload/Uploader.php

Methods summary

public viod
# __construct( array $configs )

Constructor

Constructor

Parameters

$configs

Returns

viod
public
# config( array $configs )

Set configs

Set configs

Parameters

$configs
public boolean
# upload( string $name )

Execute upload

Execute upload

Parameters

$name
fileInput's name

Returns

boolean
public string
# getSeveName( )

Get Saved filename for database

Get Saved filename for database

Returns

string
public string
# getFileExt( string $fileName )

Get filename extension

Get filename extension

Parameters

$fileName

Returns

string
public
# redirect( )

Redirect for Upload success, failure or error

Redirect for Upload success, failure or error

public array|string
# message( string $message, integer $success = 0, boolean $return = false )

Errors message handle

Errors message handle

Parameters

$message
$success
$return
false

Returns

array|string
public
# jsonHeader( )

Set JSON mime header

Set JSON mime header

public array|string
# success( string $message = "Upload successfully.", boolean $return = false )

Upload success message handle

Upload success message handle

Parameters

$message
Upload successfully.
$return
false

Returns

array|string
public array|string
# error( string $message = "Upload failed.", boolean $return = false )

Upload failed or error message handle

Upload failed or error message handle

Parameters

$message
Upload failed.
$return
false

Returns

array|string
public
# errorExit( )

Error exit

Error exit

Properties summary

public array $files

$_FILES array

$_FILES array

#
public integer $mode

Read and write authority mode

Read and write authority mode

# 0755
public string $lang
# 'EN'
public string $fileExit

Filename extension

Filename extension

#
public string $saveName

Saved filename

Saved filename

#
public string $saveURL

Url path Saved to database

Url path Saved to database

#
public string $savePath

Saved the local file path

Saved the local file path

#
public string $message

Output result message

Output result message

#
public string|integer $randomLength

Generate the length of the random file name

Generate the length of the random file name

when the date is the date() format

# 'Ymd'
public integer $randomNameType

Generate the random form

Generate the random form

NULL to retain the original file name 1 generated random strings 2 generate the date file name

# 1
public string $timezone

Timezone

Timezone

# 'PRC'
public array $formats

Allow Upload file format

Allow Upload file format

# ['gif', 'jpg', 'jpeg', 'png', 'bmp', 'webp']
public integer $maxSize

Maximum upload file size, unit KB

Maximum upload file size, unit KB

# 1024
public boolean $cover

Whether to cover the same name file, true covered, false not covered

Whether to cover the same name file, true covered, false not covered

# true
public boolean $redirect

Whether URL redirect

Whether URL redirect

# false
public string $redirectURL

Redirect url

Redirect url

# ""
public array $errors

Errors message

Errors message

# [ 'empty' => 'The upload file can\'t be empty.', 'format' => 'The uploaded file format does not conform to the regulations.', 'maxsize' => 'The upload file size too large.', 'unwritable' => 'Save the directory not to write, please change permissions.', 'not_exist' => 'Save the directory not exist.', 'same_file' => 'There are already the same file exist.' ]
Slimore API documentation generated by ApiGen