[5.3] Add mime type to disk storage via UploadedFile#16416
[5.3] Add mime type to disk storage via UploadedFile#16416jodiedunlop wants to merge 4 commits intolaravel:5.3from jodiedunlop:feature/mimetype_on_filesystem_driver
Conversation
Signed-off-by: Jodie Dunlop <jodie.dunlop@rexsoftware.com.au>
|
Store file with Store file with auto mime type (calls |
|
I think there is a mistake when passing parameters to storeAs method. |
| public function store($path, $disk = null, $mimeType = null) | ||
| { | ||
| return $this->storeAs($path, $this->hashName(), $disk); | ||
| return $this->storeAs($path, $this->hashName(), $disk, $mimeType); |
There was a problem hiding this comment.
Following @caiquecastro comment...
There should be a null here before $mimeType, currently you're passing the $mimeType as the $visibility parameter.
|
I implemented this in Laravel 5.4 by allowing an array of options to be passed to these methods: Storage::disk('local')->put('something', 'hello world', [
'visibility' => 'public',
'mimetype' => 'text/plain'
]); |
|
@taylorotwell Is this functionality not going to be back-ported to Laravel 5.3 then? As it’s a bit awkward having everything sent to S3 with a MIME type of |
|
No, 5.4 is only a few weeks away anyway. :) |
|
@GrahamCampbell But it’s useful for applications now and not every one will be upgrading to 5.4 on launch day. |
|
I agree with @martinbean, I had this problem just a few weeks ago. I had to use the AWS SDK directly to allow the mime type to be set while still allowing the file to be streamed instead of uploaded the my server then moved over to S3. |
|
Same issue and headache with 5.3 |
|
Same issue with 5.3 - can't upgrade to 5.4 yet due to lack of support from a few packages. |
Although
mimetypeis a supported configuration option for Flysystem, there is no way to pass this though the FileSystemAdapter put() method and consequently any of the convenience functions in UploadedFile. This commit adds support for amimeTypeparameter for all of the store functions within UploadedFile and to theIlluminate\Filesystem\FilesystemAdapterclass.