PHP Класс PunkAve\FileUploaderBundle\Services\FileUploader

Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$options

Открытые методы

Метод Описание
__construct ( $options )
getFiles ( $options = [] ) Get a list of files already present. The 'folder' option is required.
handleFileUpload ( $options = [] ) Handles a file upload. Call this from an action, after validating the user's right to upload and delete files and determining your 'folder' option. A good example:
removeFiles ( $options = [] ) Remove the folder specified by 'folder' and its contents.
syncFiles ( $options = [] ) Sync existing files from one folder to another. The 'fromFolder' and 'toFolder' options are required. As with the 'folder' option elsewhere, these are appended to the file_base_path for you, missing parent folders are created, etc. If 'fromFolder' does not exist no error is reported as this is common if no files have been uploaded. If there are files and the sync reports errors an exception is thrown.

Описание методов

__construct() публичный Метод

public __construct ( $options )

getFiles() публичный Метод

If you pass consistent options to this method and handleFileUpload with regard to paths, then you will get consistent results.
public getFiles ( $options = [] )

handleFileUpload() публичный Метод

$id = $this->getRequest()->get('id'); Validate the id, make sure it's just an integer, validate the user's right to edit that object, then... $this->get('punkave.file_upload').handleFileUpload(array('folder' => 'photos/' . $id)) DOES NOT RETURN. The response is generated in native PHP by BlueImp's UploadHandler class. Note that if %file_uploader.file_path%/$folder already contains files, the user is permitted to delete those in addition to uploading more. This is why we use a separate folder for each object's associated files. Any passed options are merged with the service parameters. You must specify the 'folder' option to distinguish this set of uploaded files from others.
public handleFileUpload ( $options = [] )

removeFiles() публичный Метод

If you pass consistent options to this method and handleFileUpload with regard to paths, then you will get consistent results.
public removeFiles ( $options = [] )

syncFiles() публичный Метод

If you pass consistent options to this method and handleFileUpload with regard to paths, then you will get consistent results.
public syncFiles ( $options = [] )

Описание свойств

$options защищенное свойство

protected $options