Uploader.php 976 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\Api;
  7. /**
  8. * Class Uploader specific to uploading images using services
  9. */
  10. class Uploader extends \Magento\Framework\File\Uploader
  11. {
  12. /**
  13. * Avoid running the default constructor specific to FILE upload
  14. */
  15. public function __construct()
  16. {
  17. }
  18. /**
  19. * Explicitly set the file attributes instead of setting it via constructor
  20. *
  21. * @param array $fileAttributes
  22. * @return void
  23. * @throws \Exception
  24. */
  25. public function processFileAttributes($fileAttributes)
  26. {
  27. $this->_file = $fileAttributes;
  28. if (!file_exists($this->_file['tmp_name'])) {
  29. $code = empty($this->_file['tmp_name']) ? self::TMP_NAME_EMPTY : 0;
  30. throw new \Exception('File was not processed correctly.', $code);
  31. } else {
  32. $this->_fileExists = true;
  33. }
  34. }
  35. }