Webylon 3.1 API Docs
  • Package
  • Class
  • Tree
  • Deprecated
  • Download
Version: current
  • 3.2
  • 3.1

Packages

  • auth
  • Booking
  • cart
    • shipping
    • steppedcheckout
  • Catalog
  • cms
    • assets
    • batchaction
    • batchactions
    • bulkloading
    • comments
    • content
    • core
    • export
    • newsletter
    • publishers
    • reports
    • security
    • tasks
  • Dashboard
  • DataObjectManager
  • event
  • faq
  • forms
    • actions
    • core
    • fields-basic
    • fields-dataless
    • fields-datetime
    • fields-files
    • fields-formatted
    • fields-formattedinput
    • fields-relational
    • fields-structural
    • transformations
    • validators
  • googlesitemaps
  • guestbook
  • installer
  • newsletter
  • None
  • photo
    • gallery
  • PHP
  • polls
  • recaptcha
  • sapphire
    • api
    • bulkloading
    • control
    • core
    • cron
    • dev
    • email
    • fields-formattedinput
    • filesystem
    • formatters
    • forms
    • i18n
    • integration
    • misc
    • model
    • parsers
    • search
    • security
    • tasks
    • testing
    • tools
    • validation
    • view
    • widgets
  • seo
    • open
      • graph
  • sfDateTimePlugin
  • spamprotection
  • stealth
    • captha
  • subsites
  • userform
    • pagetypes
  • userforms
  • webylon
  • widgets

Classes

  • Archive
  • File
  • Filesystem
  • FlushGeneratedImagesTask
  • FLV
  • Folder
  • Folder_UnusedAssetsField
  • GD
  • Image
  • Image_Cached
  • MediawebPage_Image
  • MP3
  • SaveFileSizeTask
  • TarballArchive
  • Upload
  • Upload_Validator
  • VideoFile

Class Upload

Manages uploads via HTML forms processed by PHP, uploads to Silverstripe's default upload directory, and either creates a new or uses an existing File-object for syncing with the database.

Object
Extended by ViewableData implements IteratorAggregate
Extended by RequestHandler
Extended by Controller
Extended by Upload
Package: sapphire\filesystem
Located at sapphire/filesystem/Upload.php

Methods summary

public
# __construct( )

Overrides

RequestHandler::__construct
public object
# getValidator( )

Get current validator

Get current validator

Returns

object
$validator
public
# setValidator( object $validator )

Set a different instance than Upload_Validator for this upload session.

Set a different instance than Upload_Validator for this upload session.

Parameters

$validator
object $validator
public Boolean|string
# load( mixed $tmpFile, mixed $folderPath = false )

Save an file passed from a form post into this object.

Save an file passed from a form post into this object.

Parameters

$tmpFile
$tmpFile array Indexed array that PHP generated for every file it uploads.
$folderPath
$folderPath string Folder path relative to /assets

Returns

Boolean|string
Either success or error-message.
public Boolean
# loadIntoFile( array $tmpFile, File $file, mixed $folderPath = false )

Load temporary PHP-upload into File-object.

Load temporary PHP-upload into File-object.

Parameters

$tmpFile
array $tmpFile
$file
File $file
$folderPath

Returns

Boolean
Boolean
public boolean
# validate( array $tmpFile )

Container for all validation on the file (e.g. size and extension restrictions). Is NOT connected to the {Validator} classes, please have a look at {FileField->validate()} for an example implementation of external validation.

Container for all validation on the file (e.g. size and extension restrictions). Is NOT connected to the {Validator} classes, please have a look at {FileField->validate()} for an example implementation of external validation.

Parameters

$tmpFile
array $tmpFile

Returns

boolean
boolean
public File
# getFile( )

Get file-object, either generated from {load()}, or manually set.

Get file-object, either generated from {load()}, or manually set.

Returns

File
File
public
# setFile( File $file )

Set a file-object (similiar to {loadIntoFile()})

Set a file-object (similiar to {loadIntoFile()})

Parameters

$file
File $file
public integer
# getAllowedMaxFileSize( string $ext = null )

Get maximum file size for all or specified file extension.

Get maximum file size for all or specified file extension.

Deprecated

2.5 Please use Upload_Validator::getAllowedMaxFileSize() instead

Parameters

$ext
string $ext

Returns

integer
Filesize in bytes
public
# setAllowedMaxFileSize( array|integer $rules )

Set filesize maximums (in bytes). Automatically converts extensions to lowercase for easier matching.

Set filesize maximums (in bytes). Automatically converts extensions to lowercase for easier matching.

Example:

array('*' => 200, 'jpg' => 1000)

Deprecated

2.5 Please use Upload_Validator::setAllowedMaxFileSize() instead

Parameters

$rules
array|int $rules
public array
# getAllowedExtensions( )

Deprecated

2.5 Please use Upload_Validator::getAllowedExtensions() instead

Returns

array
array
public
# setAllowedExtensions( array $rules )

Deprecated

2.5 Please use Upload_Validator::setAllowedExtensions() instead

Parameters

$rules
array $rules
public boolean
# isValidSize( array $tmpFile )

Determines if the bytesize of an uploaded file is valid - can be defined on an extension-by-extension basis in {$allowedMaxFileSize}

Determines if the bytesize of an uploaded file is valid - can be defined on an extension-by-extension basis in {$allowedMaxFileSize}

Deprecated

2.5 Please use Upload_Validator::isValidExtension() instead

Parameters

$tmpFile
array $tmpFile

Returns

boolean
boolean
public boolean
# isValidExtension( array $tmpFile )

Determines if the temporary file has a valid extension

Determines if the temporary file has a valid extension

Deprecated

2.5 Please use Upload_Validator::isValidExtension() instead

Parameters

$tmpFile
array $tmpFile

Returns

boolean
boolean
public
# clearErrors( )

Clear out all errors (mostly set by {loadUploaded()})

Clear out all errors (mostly set by {loadUploaded()})

public boolean
# isError( )

Determines wether previous operations caused an error.

Determines wether previous operations caused an error.

Returns

boolean
boolean
public array
# getErrors( )

Return all errors that occurred while processing so far (mostly set by {loadUploaded()})

Return all errors that occurred while processing so far (mostly set by {loadUploaded()})

Returns

array
array

Methods inherited from Controller

CurrentMember(), Now(), PastMember(), PastVisitor(), can(), curr(), defaultAction(), disableBasicAuth(), getAction(), getFormOwner(), getRequest(), getResponse(), getSession(), getURLParams(), getViewer(), handleAction(), handleRequest(), hasAction(), hasActionTemplate(), has_curr(), init(), isAjax(), join_links(), popCurrent(), pushCurrent(), redirect(), redirectBack(), redirectedTo(), render(), setSession(), setURLParams()

Methods inherited from RequestHandler

allowedActions(), checkAccessAction(), httpError()

Methods inherited from ViewableData

ATT_val(), BaseHref(), CSSClasses(), ColumnBreak(), ColumnCalc(), ColumnNumber(), ColumnPad(), ColumnPos(), CurrentPage(), Debug(), Even(), EvenOdd(), First(), FirstLast(), HasPerm(), IsAjax(), JS_val(), Last(), Me(), Middle(), MiddleString(), Modulus(), MultipleOf(), Odd(), Pos(), RAW_val(), SQL_val(), ThemeDir(), ThemeName(), Top(), TotalItems(), XML_val(), __get(), __isset(), __set(), buildCastingCache(), cachedCall(), castingClass(), castingHelper(), castingHelperPair(), castingObjectCreator(), castingObjectCreatorPair(), customise(), defineMethods(), escapeTypeForField(), getField(), getIterator(), getSecurityID(), getXMLValues(), hasField(), hasValue(), i18nLocale(), iteratorProperties(), obj(), renderWith(), setCustomisedObj(), setField()

Methods inherited from Object

__call(), __toString(), __wakeup(), addMethodsFrom(), addStaticVars(), addWrapperMethod(), add_extension(), add_static_var(), allMethodNames(), cacheToFile(), cacheToFileWithArgs(), clearCache(), combined_static(), create(), createMethod(), create_from_string(), exists(), extInstance(), extend(), getCustomClass(), getExtensionInstance(), getExtensionInstances(), get_extensions(), get_static(), hasExtension(), hasMethod(), has_extension(), invokeWithExtensions(), is_a(), loadCache(), parentClass(), parse_class_spec(), remove_extension(), sanitiseCachename(), saveCache(), set_stat(), set_static(), set_uninherited(), stat(), strong_create(), uninherited(), uninherited_static(), useCustomClass()

Magic methods summary

Properties summary

protected File $file
#

A File object

A File object

protected Upload_Validator $validator
#

An instance of Upload_Validator

An instance of Upload_Validator

protected array $tmpFile
#

Information about the temporary file produced by the PHP-runtime.

Information about the temporary file produced by the PHP-runtime.

protected array $errors
#

Processing errors that can be evaluated, e.g. by Form-validation.

Processing errors that can be evaluated, e.g. by Form-validation.

public static string $uploads_folder
#

A foldername relative to /assets, where all uploaded files are stored by default.

A foldername relative to /assets, where all uploaded files are stored by default.

Properties inherited from Controller

$action, $allowed_actions, $baseInitCalled, $basicAuthEnabled, $controller_stack, $request, $requestParams, $response, $session, $urlParams, $url_handlers

Properties inherited from RequestHandler

$brokenOnConstruct

Properties inherited from ViewableData

$casting, $customisedObject, $default_cast, $failover, $iteratorPos, $iteratorTotalItems

Properties inherited from Object

$class, $extension_instances, $extensions

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -
Webylon 3.1 API Docs API documentation generated by ApiGen 2.8.0