Overview

Namespaces

  • DSchoenbauer
    • FileUpload
      • Exception

Classes

  • FileUpload
  • Overview
  • Namespace
  • Class

Class FileUpload

One class to manage all PHP file upload needs

Namespace: DSchoenbauer\FileUpload
Author: David Schoenbauer dschoenbauer@gmail.com
Since: 1.0.0
Located at FileUpload/FileUpload.php
Methods summary
public
# __construct( array $allowedTypes = [], integer $allowedFileSize = 0 )

Parameters

$allowedTypes
array of allowed mime types. The key must be the file extention
$allowedFileSize
maximum file size in megabytes
public array
# getAllowedTypes( )

Defines which file types are allowed

Defines which file types are allowed

Returns

array
public
# setAllowedTypes( array $allowedTypes )

Defines which file types are allowed

Defines which file types are allowed

Parameters

$allowedTypes
expects an array with a file extention as the key and the value as the mime-type

Returns


$this
public integer
# getAllowedFileSize( )

Provides the maximum allowed file size in megabytes

Provides the maximum allowed file size in megabytes

Returns

integer
returns the maximum file size allowed
public
# setAllowedFileSize( integer $allowedFileSize )

Provide the maximum allowed file size in megabytes

Provide the maximum allowed file size in megabytes

Parameters

$allowedFileSize
File size in megabytes

Returns


$this
public string
# handleFile( type $fileHandle, string $targetFile )

Manages the aspects of the uploading of a file to a server

Manages the aspects of the uploading of a file to a server

Parameters

$fileHandle
key of the file that will be found in the $_FILES array
$targetFile
path and file name of the file. Extention of original file will be applied to this.

Returns

string
computed path of uploaded file

Throws

DSchoenbauer\FileUpload\Exception\InvalidParametersException
DSchoenbauer\FileUpload\Exception\NoFileSentException
DSchoenbauer\FileUpload\Exception\FileTooLargeIniException
DSchoenbauer\FileUpload\Exception\FileTooLargeFormException
DSchoenbauer\FileUpload\Exception\UnknownErrorException
DSchoenbauer\FileUpload\Exception\FileTooLargePhpException
DSchoenbauer\FileUpload\Exception\UnsupportedFileType
DSchoenbauer\FileUpload\Exception\FileFailedToMoveException
API documentation generated by ApiGen