3 namespace Drupal\dropzonejs;
5 use Drupal\Core\Session\AccountProxyInterface;
6 use Drupal\file\FileInterface;
9 * Provides an interface for classes that save DropzoneJs uploads.
11 interface DropzoneJsUploadSaveInterface {
14 * Creates a file entity form an uploaded file.
16 * Note: files being created using this method are flagged as temporary and
20 * The path to the file we want to upload.
21 * @param string $destination
22 * A string containing the URI that the file should be copied to. This must
23 * be a stream wrapper URI.
24 * @param string $extensions
25 * A space separated list of valid extensions.
26 * @param \Drupal\Core\Session\AccountProxyInterface $user
27 * The owner of the file.
28 * @param array $validators
29 * (Optional) Associative array of callback functions used to validate the
30 * file. See file_validate() for more documentation. Note that we add
31 * file_validate_extensions and file_validate_name_length in this method
34 * @return \Drupal\file\FileInterface|bool
35 * The file entity of the newly uploaded file or false in case of a failure.
36 * The file isn't saved yet. That should be handled by the caller.
38 public function createFile($uri, $destination, $extensions, AccountProxyInterface $user, array $validators = []);
41 * Validate the uploaded file.
43 * @param \Drupal\file\FileInterface $file
44 * The file entity object.
45 * @param string $extensions
46 * A space separated string of valid extensions.
47 * @param array $additional_validators
48 * An optional, associative array of callback functions used to validate the
49 * file. See file_validate() for more documentation. Note that we add
50 * file_validate_extensions and file_validate_name_length in this method
54 * An array containing validation error messages.
56 public function validateFile(FileInterface $file, $extensions, array $additional_validators = []);