You are here

public function DropzoneJsUploadSaveInterface::createFile in DropzoneJS 8

Same name and namespace in other branches
  1. 8.2 src/DropzoneJsUploadSaveInterface.php \Drupal\dropzonejs\DropzoneJsUploadSaveInterface::createFile()

Creates a file entity form an uploaded file.

Note: files being created using this method are flagged as temporary and not saved yet.

Parameters

string $uri: The path to the file we want to upload.

string $destination: A string containing the URI that the file should be copied to. This must be a stream wrapper URI.

string $extensions: A space separated list of valid extensions.

\Drupal\Core\Session\AccountProxyInterface $user: The owner of the file.

array $validators: (Optional) Associative array of callback functions used to validate the file. See file_validate() for more documentation. Note that we add file_validate_extensions and file_validate_name_length in this method already.

Return value

\Drupal\file\FileInterface|bool The file entity of the newly uploaded file or false in case of a failure. The file isn't saved yet. That should be handled by the caller.

1 method overrides DropzoneJsUploadSaveInterface::createFile()
DropzoneJsUploadSave::createFile in src/DropzoneJsUploadSave.php
Creates a file entity form an uploaded file.

File

src/DropzoneJsUploadSaveInterface.php, line 38

Class

DropzoneJsUploadSaveInterface
Provides an interface for classes that save DropzoneJs uploads.

Namespace

Drupal\dropzonejs

Code

public function createFile($uri, $destination, $extensions, AccountProxyInterface $user, array $validators = []);