xplo.re Medusa Core Framework 3.2
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Event
  • Todo
  • Download

Namespaces

  • Core
    • Authentication
      • Auto
        • Driver
      • Driver
    • Cache
      • Driver
    • Charset
      • Driver
    • Configuration
      • Driver
    • Controller
    • Converter
      • Driver
    • Decoder
      • Driver
    • Encoder
      • Driver
    • Env
      • Authentication
      • Locale
      • Proxy
      • Server
        • HTTP
        • Redirect
        • X
    • Exception
    • Exchange
      • Driver
    • Fault
      • Formatter
        • Driver
      • Incident
        • Exception
      • Reporter
        • Driver
    • Field
    • Filter
      • Driver
    • Formatter
      • Driver
        • coreuimarkup
          • Token
    • Hash
    • Loader
    • Locale
    • Log
      • Driver
    • Module
      • Dependency
        • Requirement
          • Core
          • PHP
      • Linkage
        • Driver
    • PDF
    • Plugin
    • Query
      • Driver
    • Server
      • Driver
    • Session
      • Driver
    • Set
    • Storage
      • Driver
      • Field
        • Element
    • Stream
      • Driver
    • String
    • Translation
      • Driver
      • Language
        • Driver
    • Type
    • URI
      • Driver
    • Version
    • View
      • Driver
        • coreui
          • Control
            • Button
            • Table
          • Element
        • htmlbuilder
          • Tags
        • yui
          • Modules
  • None
  • PHP

Classes

  • Authentication
  • Authentication_Token
  • AutoLoader
  • Cache
  • Charset
  • ClassDescriptor
  • Closure
  • Configuration
  • Controller
  • Converter
  • Date
  • Decoder
  • Delegate
  • Dispatcher
  • Encoder
  • Env
  • Env_Field
  • Env_File
  • Env_FileList
  • Env_Request
  • Env_SERVER
  • Exchange
  • Fault
  • Field
  • Filter
  • Filter_Value
  • Formatter
  • Hash
  • IP
  • Loader
  • Locale
  • Locale_Node
  • Log
  • Module
  • Module_Iterator
  • Nothing
  • Object
  • OS
  • Plugin
  • Profiler
  • Query
  • Registry
  • Resource
  • Server
  • Session
  • Session_Token
  • Set
  • Storage
  • Storage_Result
  • Storage_Statement
  • Stream
  • Translation
  • URI
  • URI_Parameters
  • UUID
  • Value
  • Version
  • View

Interfaces

  • Accessor
  • Chainable
  • Comparable
  • Configurable
  • Equality
  • Identity
  • Inquiry
  • Masquerade
  • Mutator
  • SeekableStream
  • Storable
  • Variator

Exceptions

  • Exception

Constants

  • Copyright
  • ProductName
  • Version

Class Env_File

Extended value that represents an uploaded file.

Core\Object implements Core\Chainable
Extended by Core\Set implements Core\Accessor
Extended by Core\Value implements Core\Comparable, Core\Equality, Core\Identity
Extended by Core\Env_File
Namespace: Core
Package: Core\Env
Since: 3.1
Requires: PHP 5.3, Fileinfo
Version: 1.0
Located at Env.inc.php

Methods summary

public
# __construct( string $key, mixed $index = null )

Parameters

$key
File upload input name.
$index
Index for multiple files upload.

Since

3.1

Overrides

Core\Value::__construct
public string
# clientFilename( )

Returns the original filename given by the client.

Returns the original filename given by the client.

Returns

string
The original filename given by the client.

See

Core\Env_File::filename()

Since

3.1
public string
# detectedMIMEType( )

Tries to detected the file MIME type regardless of the browser-supplied value.

Tries to detected the file MIME type regardless of the browser-supplied value.

Returns

string
Detected file MIME type or null, if detection failed.

Remark

The detected MIME content type is cached for the corresponding file.

Since

3.1
protected mixed|string
# detectedMIMEType_get( string $filename )

Determines the MIME type of a given file.

Determines the MIME type of a given file.

Parameters

$filename
Name of file to determine MIME type of.

Returns

mixed|string

Since

3.1
public array
# data( )

Returns the information array for the uploaded file.

Returns the information array for the uploaded file.

Returns

array
Array with all data fields available for the uploaded file.

Since

3.1
public integer
# errorCode( )

Returns the error code of the file upload. An error code of 0 indicates success. If the error code is 0 but Core\Env_File::success() returns false, the uploaded file is invalid.

Returns the error code of the file upload. An error code of 0 indicates success. If the error code is 0 but Core\Env_File::success() returns false, the uploaded file is invalid.

Returns

integer
Error code or 0 on successful upload.

Since

3.1
public string
# filename( )

Returns the temporary filename of the uploaded file.

Returns the temporary filename of the uploaded file.

Returns

string
The temporary filename of the uploaded file.

See

Core\Env_File::clientFilename()
Core\Env_File::moveTo()

Since

3.1
public string
# md5( )

Returns the raw MD5 checksum of the uploaded file.

Returns the raw MD5 checksum of the uploaded file.

Returns

string
Binary MD5 checksum of 16 bytes length.

Since

3.1
public string
# mimeType( )

Returns the MIME type of the uploaded file as given by the client.

Returns the MIME type of the uploaded file as given by the client.

Returns

string
The MIME type of the uploaded file as given by the client.

Remark

The returned value is passed verbatim from the client and should therefore treated with caution.


Since

3.1
public boolean
# moveTo( string $targetName )

Moves an uploaded file to a new destination.

Moves an uploaded file to a new destination.

Parameters

$targetName
The destination file name for the uploaded file.

Returns

boolean

true on success, otherwise false if either the file upload failed or the uploaded file is not considered valid.

Throws

Core\Exception\IO
Failed to move the file. See exception message for details.

Remark

This method includes file upload validity checks opposed to a direct rename call of the stored temporary.


See

Core\Env_File::filename()

Since

3.1
public boolean
# multipleFiles( )

Helper method to distinguish between multiple and single file uploads. Upon accessing the environment this method should be called on the returned object to test whether a single file has been uploaded and the object can be treated as such, or multiple files has been uploaded and the returned object is an iterator for all uploaded files.

Helper method to distinguish between multiple and single file uploads. Upon accessing the environment this method should be called on the returned object to test whether a single file has been uploaded and the object can be treated as such, or multiple files has been uploaded and the returned object is an iterator for all uploaded files.

Returns

boolean

false, if a single file is represented by this object, otherwise true.

Since

3.1
public string
# sha1( )

Returns the raw SHA-1 checksum of the uploaded file.

Returns the raw SHA-1 checksum of the uploaded file.

Returns

string
Binary SHA-1 checksum of 20 bytes length.

Since

3.1
public integer
# size( )

Returns the size in bytes of the uploaded file.

Returns the size in bytes of the uploaded file.

Returns

integer
Size in bytes of the uploaded file.

Since

3.1
public boolean
# success( )

Indicates a successfully upload including file validity check.

Indicates a successfully upload including file validity check.

Returns

boolean

true if no error occurred during upload and the uploaded file is a verified upload, otherwise false.

Since

3.1
public boolean
# valid( )

Indicates whether the associated file is a truly uploaded file.

Indicates whether the associated file is a truly uploaded file.

Returns

boolean
true, if the file is a verified upload, otherwise false.

Remark

This method does not check the error code status of the upload. Use Core\Env_File::success() to test for error code status and file validity.


Since

3.1

Methods inherited from Core\Value

__clone(), __invoke(), __toString(), bit(), bool(), compareTo(), explode(), filter(), float(), int(), isArray(), isBoolean(), isCallable(), isCallback(), isEqualTo(), isFloat(), isIdenticalTo(), isInteger(), isNull(), isNumeric(), isObject(), isOffset(), isResource(), isScalar(), isString(), set(), string(), stringObject(), toArray(), toLower(), toUpper()

Methods inherited from Core\Set

__get(), __isset()

Methods inherited from Core\Object

__autocreateFactory(), __call(), __processParameters(), attachMethod(), chain(), getValueForKey(), getValueForKeyPath(), getValueForUndefinedKey(), hash(), issetValueForKey(), setValueForKey(), setValueForKeyPath(), setValueForUndefinedKey(), uuid()

Constants summary

integer SuccessStatus

Success error code, file upload completed successfully.

Success error code, file upload completed successfully.

Since

3.1
# \UPLOAD_ERR_OK
integer SizeLimitExceededStatus

The uploaded file exceeds the upload_max_filesize directive in php.ini.

The uploaded file exceeds the upload_max_filesize directive in php.ini.

Since

3.1
# \UPLOAD_ERR_INI_SIZE
integer FormLimitExceededStatus

The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.

The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.

Since

3.1
# \UPLOAD_ERR_FORM_SIZE
integer PartialStatus

The uploaded file was only partially uploaded.

The uploaded file was only partially uploaded.

Since

3.1
# \UPLOAD_ERR_PARTIAL
integer NoFileStatus

No file was uploaded.

No file was uploaded.

Since

3.1
# \UPLOAD_ERR_NO_FILE
integer NoTemporaryDirectoryStatus

Missing a temporary folder.

Missing a temporary folder.

Since

3.1
# \UPLOAD_ERR_NO_TMP_DIR
integer WriteErrorStatus

Failed to write file to disk.

Failed to write file to disk.

Since

3.1
# \UPLOAD_ERR_CANT_WRITE
integer DeniedStatus

A PHP extension stopped the file upload. PHP does not provide a way to ascertain which extension caused the file upload to stop; examining the list of loaded extensions with phpinfo() may help.

A PHP extension stopped the file upload. PHP does not provide a way to ascertain which extension caused the file upload to stop; examining the list of loaded extensions with phpinfo() may help.

See

phpinfo()

Since

3.1
# \UPLOAD_ERR_EXTENSION

Constants inherited from Core\Value

Bit, Boolean, Float, Integer, LowercaseString, String, StringObject, UppercaseString

Constants inherited from Core\Object

AnyParameterType, AutochainParameterType, AutocreateParameterType, BooleanParameterType, CharParameterType, EnumParameterType, IntegerParameterType, RealParameterType, StringParameterType, UserParameterType

Properties summary

protected mixed $_v_index

The current index for a multiple files upload, null otherwise.

The current index for a multiple files upload, null otherwise.

Since

3.1
#
protected string $_v_key

The _FILES set key this instance is derived from.

The _FILES set key this instance is derived from.

Since

3.1
#

Properties inherited from Core\Value

$_v_onSet, $_v_value

Magic properties

public read-only string $clientFilename

Original filename given by the client.

public read-only array $data

Array with all data fields available for the uploaded file.

public read-only string $detectedMIMEType

Detected file MIME type or null, if detection failed.

public read-only integer $errorCode

Error code or 0 on successful upload.

public read-only string $filename

The temporary filename of the uploaded file.

public read-only mixed $index

Iteration index for a multiple files set.

public read-only string $key

Upload input form key of file set.

public read-only string $md5

Binary MD5 checksum of 16 bytes length.

public read-only string $mimeType

The MIME type of the uploaded file as given by the client.

public read-only boolean $multipleFiles

Status whether multiple files are represented.

public read-only string $sha1

Binary SHA-1 checksum of 20 bytes length.

public read-only integer $size

Size in bytes of the uploaded file.

public read-only boolean $success

Combined status of successful and verified upload.

public read-only boolean $valid

Status of verified upload.

Magic properties inherited from Core\Value

$bit, $bool, $float, $int, $isArray, $isBoolean, $isCallable, $isCallback, $isFloat, $isInteger, $isNull, $isNumeric, $isObject, $isOffset, $isResource, $isScalar, $isString, $onSet, $string, $stringObject, $value

Magic properties inherited from Core\Object

$hash, $uuid

xplo.re Medusa Core Framework 3.2 API documentation generated by ApiGen