Codem\DamnFineUploader\UppyField
Synopsis
class UppyField
extends DamnFineUploaderField
{
- // Inherited constants from DamnFineUploaderField
- const IMPLEMENTATION_TRADITIONAL_CORE = 'uppy';
- const IMPLEMENTATION_TRADITIONAL_UI = 'uppy';
- const IMPLEMENTATION_UPPY = 'uppy';
- const UUID_NAME = 'dfu_uuid';
- // members
- protected $implementation = parent::IMPLEMENTATION_UPPY;
- private static array $allowed_actions = ;
- // Inherited members from DamnFineUploaderField
- protected string $file_input_param;
- protected array $lib_config;
- protected array $runtime_config;
- protected $option_delete;
- protected array $option_request;
- protected string $default_accepted_types;
- protected boolean $use_date_folder;
- protected string $implementation;
- protected boolean $default_configuration_complete;
- // methods
- protected void setRequirements()
- public void getImplementation()
- public boolean remove()
- public string UploaderConfig()
- protected HTTPResponse uploadSuccessfulResponse()
- protected HTTPResponse uploadErrorResponse()
- protected HTTPResponse errorResponse()
- protected HTTPResponse removeSuccessResponse()
- protected HTTPResponse removeErrorResponse()
- // Inherited methods from DamnFineUploaderField
- public void __construct()
- public void dataValue()
- public void Value()
- public MimeUploadValidator getValidator()
- public $this setValidator()
- protected abstract void setRequirements()
- public abstract void getImplementation()
- public abstract void UploaderConfig()
- protected abstract HTTPResponse uploadSuccessfulResponse()
- protected abstract HTTPResponse uploadErrorResponse()
- protected abstract HTTPResponse errorResponse()
- protected abstract HTTPResponse removeSuccessResponse()
- protected abstract HTTPResponse removeErrorResponse()
- protected void getSecurityTokenFromRequest()
- protected void getFileUuidFromRequest()
- public HTTPResponse upload()
- public void remove()
- protected final void removeFile()
- public string UploadLink()
- public string RemoveLink()
- public final void setUseDateFolder()
- protected final void libraryRequirements()
- public final void initFieldConfig()
- protected void setUploaderDefaultConfig()
- public void hasDefaultConfiguration()
- public void setSecurityToken()
- public void setRequestEndpoint()
- public string getRequestEndpoint()
- public void setDeleteEndpoint()
- public string getDeleteEndpoint()
- public void setOptionRequest()
- public void setOptionDelete()
- public void getUploaderConfigValue()
- public array getUploaderConfig()
- public void setConfig()
- public array filterTypes()
- public DamnFineUploaderField setAcceptedTypes()
- public array getAcceptedTypes()
- public void getSystemAllowedMaxFileSize()
- public void setAllowedMaxFileSize()
- public void setAcceptedMaxFileSize()
- public void setAcceptedMinFileSize()
- public void setAllowedMaxItemLimit()
- public void setAcceptedMaxDimensions()
- public void setAcceptedMinDimensions()
- public final array getExtensionsForTypes()
- public void AcceptedExtensions()
- public void AcceptedFileSize()
- public void AcceptedMinFileSize()
- public void AcceptedItemLimit()
- public void AcceptedMaxWidth()
- public void AcceptedMaxHeight()
- public void AcceptedMaxDimensions()
- public void AcceptedMinWidth()
- public void AcceptedMinHeight()
- public void AcceptedMinDimensions()
- public void AcceptsImages()
- public void Field()
- public void FieldHolder()
- public void SmallFieldHolder()
- protected void getMimeTypeFromExtension()
- protected final void parseMimeType()
- protected final void isUploadedFile()
- protected array checkUploadedFile()
- public boolean isDeniedMimeType()
- public HTTPResponse|false validateUpload()
- protected static void sign_uuid()
- protected void getUuid()
- public void overSize()
Hierarchy
Constants
Name | Value |
---|---|
IMPLEMENTATION_TRADITIONAL_CORE | 'uppy' |
IMPLEMENTATION_TRADITIONAL_UI | 'uppy' |
IMPLEMENTATION_UPPY | 'uppy' |
UUID_NAME | 'dfu_uuid' |
Members
private
- $allowed_actions — array
protected
- $default_accepted_types
- $default_configuration_complete
- $file_input_param
- $implementation
- $implementation
- $lib_config
- $option_delete
- $option_request
- $runtime_config
- $use_date_folder
Methods
protected
- errorResponse() — Error response for Uppy
- removeErrorResponse() — Return the response that Uppy expects on file removal error
- removeSuccessResponse() — Return the response that Uppy expects on successful file removal
- setRequirements()
- uploadErrorResponse() — Return the response that Uppy expects on error
- uploadSuccessfulResponse() — Return the response that Uppy expects
public
- UploaderConfig() — Template helper method for UppyField, returns the serialised configuration string for the library
- getImplementation()
- remove() — Uppy does not support removal of files post-upload
Inherited from Codem\DamnFineUploader\DamnFineUploaderField
protected
- checkUploadedFile()
- errorResponse() — Error response
- getFileUuidFromRequest() — Given a request, get the file uuid
- getMimeTypeFromExtension()
- getSecurityTokenFromRequest() — Given a request, get the form security token
- getUuid()
- isUploadedFile()
- libraryRequirements() — Based on the implementation, set library requirements and the template to use
- parseMimeType()
- removeErrorResponse() — Return the response on failed removal
- removeFile() — Remove a file based on its uuid and the form's security token You can override this handling if you wish to modify the response (e.g a 202 response)
- removeSuccessResponse() — Return the response on successful removal
- setRequirements() — Each implementation requires it's own requirements
- setUploaderDefaultConfig() — Sets the default config from YAML configuration and applies some configuration based on this form
- sign_uuid() — Sign the file token sent by the frontend library in the request
- uploadErrorResponse() — Response for a failed upload
- uploadSuccessfulResponse() — Response for a successful upload
public
- AcceptedExtensions() — AcceptedExtensions - a template helper method
- AcceptedFileSize() — AcceptedFileSize - a template helper method to return allowed file size in MB
- AcceptedItemLimit() — AcceptedItemLimit - a template helper method
- AcceptedMaxDimensions()
- AcceptedMaxHeight() — AcceptedMaxHeight - a template helper method
- AcceptedMaxWidth() — AcceptedMaxWidth - a template helper method
- AcceptedMinDimensions()
- AcceptedMinFileSize() — AcceptedMinFileSize - a template helper method to return minimkum file size in MB
- AcceptedMinHeight() — AcceptedMinHeight - a template helper method
- AcceptedMinWidth() — AcceptedMinWidth - a template helper method
- AcceptsImages() — Test accepted mimetypes for an image/* value
- Field()
- FieldHolder()
- RemoveLink() — Return a Relative remove link for this field (for remove file actions)
- SmallFieldHolder() — The Small Field Holder is the large holder
- UploadLink() — Return a Relative upload link for this field
- UploaderConfig() — Implementations must provide this template helper method
- Value()
- dataValue() — The value is an array of file upload ids, with keys determined by the frontend library The file upload ids are passed back to the uploader after a successful call to self::upload()
- filterTypes() — Set accepted types for this file, extensions are determined based on the types provided
- getAcceptedTypes() — Return the accepted types in configuration, set by setAcceptedTypes This should be called after setUploaderDefaultConfig() is processed
- getDeleteEndpoint() — Get the DELETE endpoint for uploads
- getExtensionsForTypes() — Return a list of extensions matching the file types provided
- getImplementation() — ..and implementation
- getRequestEndpoint() — Get the request endpoint for uploads
- getSystemAllowedMaxFileSize() — Returns the system provided max file size, in bytes
- getUploaderConfig() — Return all library configuration
- getUploaderConfigValue() — Get a single value from config, this populates lib_config if it is not already created
- getValidator() — Get custom validator for this field
- hasDefaultConfiguration() — Checks whether lib_config is present and complete
- initFieldConfig() — initialise the field configuration and set a default,sane config specification
- isDeniedMimeType() — Given a mimetpye, check if configuration denies it
- overSize() — Return how oversize a value is
- remove() — Action to handle removal of a single file via its uuid.
- setAcceptedMaxDimensions() — Set max dimensions for image uploads
- setAcceptedMaxFileSize() — This method is provided for consistency
- setAcceptedMinDimensions() — Set min dimensions for image uploads
- setAcceptedMinFileSize() — setAcceptedMinFileSize - set the minimum upload file size Worth noting that you can provide a minSizeLimit > the sizeLimit here, in which case the minSizeLimit will be reset to 0
- setAcceptedTypes() — Set accepted types for this file, extensions are determined based on the types provided If called, this is merged into the lib_config during setUploaderDefaultConfig()
- setAllowedMaxFileSize() — Set the maximum allowed filesize, in bytes Note that if the system setting is lower, that will be used
- setAllowedMaxItemLimit()
- setConfig() — Provide runtime config to be merged into lib_config
- setDeleteEndpoint() — Set a delete endpoint (absolute or relative URL only) or reset based on the field's form (if available) When using this method other deleteFile options are sourced from {@link self::setUploaderDefaultConfig()} To set custom deleteFile options see {@link self::setOptionDelete()}
- setOptionDelete() — Provide custom deleteFile options This requires your own delete implementation with checks and balances
- setOptionRequest() — Provide custom request endpoint configuration
- setRequestEndpoint() — Set a request endpoint (absolute or relative URL only) or reset based on the field's form (if available) If you set a custom endpoint for uploads, you will need to handle the upload appropriately and return the expected result When using this method other request options are sourced from {@link self::setUploaderDefaultConfig()} To set custom request options see {@link self::setOptionRequest()}
- setSecurityToken() — Set a Form Security Token on config
- setUseDateFolder() — setUseDateFolder - triggers the upload folder to be date based
- setValidator() — Set custom validator for this field
- upload() — Action to handle upload of a single file
- validateUpload() — Validate the upload request On success, returns an HTTPResponse matching the libraries expected 'Upload OK' result On failure, returns boolean false or throws an \Exception