diff --git a/circle.yml b/circle.yml index d1058f9..7bfa01d 100644 --- a/circle.yml +++ b/circle.yml @@ -1,6 +1,6 @@ machine: php: - version: 7.0.4 + version: 7.1.9 dependencies: cache_directories: diff --git a/src/Contracts/Uploader.php b/src/Contracts/Uploader.php index c4f130d..4d11f4e 100644 --- a/src/Contracts/Uploader.php +++ b/src/Contracts/Uploader.php @@ -15,13 +15,14 @@ interface Uploader * * @param string $path * @param string|null $disk + * @param mixed $options * * @throws \Shoperti\Uploader\Exceptions\DisallowedFileException * @throws \Shoperti\Uploader\Exceptions\RemoteFileException * * @return \Shoperti\Uploader\UploadResult */ - public function upload($path, $disk = null); + public function upload($path, $disk = null, $options = []); /* * Uploads a file to a filesystem disk with a name. @@ -29,11 +30,12 @@ public function upload($path, $disk = null); * @param string $path * @param string $name * @param string|null $disk + * @param mixed $options * * @throws \Shoperti\Uploader\Exceptions\DisallowedFileException * @throws \Shoperti\Uploader\Exceptions\RemoteFileException * * @return \Shoperti\Uploader\UploadResult */ - public function uploadAs($path, $name, $disk = null); + public function uploadAs($path, $name, $disk = null, $options = []); } diff --git a/src/Uploader.php b/src/Uploader.php index 0ef3625..2cfacbf 100644 --- a/src/Uploader.php +++ b/src/Uploader.php @@ -78,13 +78,14 @@ public function __construct( * * @param string $path * @param string|null $disk + * @param mixed $options * * @throws \Shoperti\Uploader\Exceptions\DisallowedFileException * @throws \Shoperti\Uploader\Exceptions\RemoteFileException * * @return \Shoperti\Uploader\UploadResult */ - public function upload($path = null, $disk = null) + public function upload($path = null, $disk = null, $options = []) { $processedFile = $this->fileProcessor->process($this->uploadedFile, $this->config); @@ -100,7 +101,7 @@ public function upload($path = null, $disk = null) try { // put() may throw an \InvalidArgumentException - $wasMoved = $this->filesystem->disk($disk)->put($uploadPath, (string) $processedFile); + $wasMoved = $this->filesystem->disk($disk)->put($uploadPath, (string) $processedFile, $options); $e = null; } catch (Exception $e) { $wasMoved = false; @@ -128,13 +129,14 @@ public function upload($path = null, $disk = null) * @param string $path * @param string $name * @param string|null $disk + * @param mixed $options * * @throws \Shoperti\Uploader\Exceptions\DisallowedFileException * @throws \Shoperti\Uploader\Exceptions\RemoteFileException * * @return \Shoperti\Uploader\UploadResult */ - public function uploadAs($path, $name, $disk = null) + public function uploadAs($path, $name, $disk = null, $options = []) { $processedFile = $this->fileProcessor->process($this->uploadedFile, $this->config); @@ -148,7 +150,7 @@ public function uploadAs($path, $name, $disk = null) try { // put() may throw an \InvalidArgumentException - $wasMoved = $this->filesystem->disk($disk)->put($uploadPath, (string) $processedFile); + $wasMoved = $this->filesystem->disk($disk)->put($uploadPath, (string) $processedFile, $options); $e = null; } catch (Exception $e) { $wasMoved = false;