Questions tagged [flysystem]

flysystem is a PHP library that provides an abstraction layer for filesystems. It provides a common API for handling standard tasks across multiple file storage engines, and enables easily swapping local and remote filesystems and emulating directories in systems that don't support them.

134 questions
98
votes
13 answers

How to get file URL using Storage facade in laravel 5?

I've been experimenting using the new Flysystem integration with Laravel 5. I am storing 'localised' paths to the DB, and getting the Storage facade to complete the path. For example I store screenshots/1.jpg and using…
daviestar
  • 4,531
  • 3
  • 29
  • 47
40
votes
2 answers

Why does Laravel's getMimeType() method identify a file as "application/octet-stream" when the file has the type attribute of "audio/mpeg"?

I'm trying to upload a MP3 file to a Laravel application and have ran into an issue where even though the file has an attribute set to "audio/mpeg" it is uploaded as a "application/octet-stream" (.bin) file. When I try to die and dump the file on…
Kirkland
  • 798
  • 1
  • 8
  • 20
29
votes
10 answers

Add Metadata, headers (Expires, CacheControl) to a file uploaded to Amazon S3 using the Laravel 5.0 Storage facade

I am trying to find out how to add in Metadata or headers (Expires, CacheControl etc.) to a file uploaded using the Laravel 5.0 Storage facade. I have use the page here as reference. http://laravel.com/docs/5.0/filesystem The following code works…
alexmcfarlane
  • 1,016
  • 2
  • 13
  • 33
18
votes
1 answer

How to leverage the glob method of Filesystem class with StorageFacade?

This is concerning Laravel 5. I can see in Illuminate\Filesystem\Filesystem a method called glob($pattern, $flags = 0) Unfortunately, this method is not reflected in the default FilesystemAdapter shipped with Laravel 5. This would be great, due to…
Réjôme
  • 1,474
  • 3
  • 16
  • 25
10
votes
2 answers

How can I use a resource to write line by line but still use Laravel's built in Storage?

I want to use Storage::put to write a file. The file is potentially very large (>100MB), so I want to utilise a stream so I don't blindly place everything into memory. I'm going to be making multiple API requests, and then looping through their…
Mike
  • 8,767
  • 8
  • 49
  • 103
9
votes
1 answer

Laravel's Filesystem with s3 using the wrong url

I am using Laravel's Filesystem to store items on s3 and I am getting the wrong URL. Storage::disk('s3')->put('file.txt', 'Contents'); Gives me the error CurlException in CurlMulti.php line 359: [curl] 6: Could not resolve host:…
whoacowboy
  • 6,982
  • 6
  • 44
  • 78
8
votes
1 answer

PHP 7.0.5: Use of undefined constant FTP_BINARY - assumed 'FTP_BINARY'

Upgrading to PHP 7.0.5 on Windows IIS (finally since the sqlsrv PDO drivers are available). I'm using Laravel 5.1 and when trying to connect to an FTP drive I get the following error from…
dsturbid
  • 1,899
  • 1
  • 17
  • 24
8
votes
3 answers

League/Flysystem fstat() expects parameter 1 to be resource, object given

I am in the process of upgrading a project from Laravel 5 to 5.1. One package that needed to be updated was League\Flysystem. I am using Intervention\Image to resize an image and then Flysystem to save it to S3. The code below was working with 5.0…
NightMICU
  • 9,000
  • 30
  • 89
  • 121
8
votes
2 answers

Laravel 5 Flysystem - download file from remote disk

I am storing files for a site on Rackspace using Flysystem. Uploading is no problem, having trouble figuring out how to start a download for a file - this is what I have tried Storage::disk('rackspace'); return response()->download('file-library/' .…
NightMICU
  • 9,000
  • 30
  • 89
  • 121
7
votes
1 answer

Streaming Amazon S3 Objects From a Web Server Using Laravel

In my web-application built using laravel 5.1, users can upload some sensitive files that I store in Amazon S3. Later I want users WITH PERMISSION to download this file. Since I want this auth check in place, I cannot download the file using…
Rash
  • 7,677
  • 1
  • 53
  • 74
6
votes
2 answers

Trying to upload to Google cloud storage using Superbalist/flysystem-google-cloud-storage

UPDATE: Fixed it using the code from this PR, I've asked to assist in getting the PR merged, but for now my issues is sorted with a fork. Trying to upload to Google cloud storage via the following…
André Figueira
  • 6,048
  • 14
  • 48
  • 62
6
votes
1 answer

BinaryFileResponse with php resource from Flysystem

I need to use BinaryFileResponse for correct handling of videos with Length Headers and co. Also I want the user to allow configured other storages (S3, Dropbox). The flysystem readStream method will return a resource but BinaryFileResponse needs a…
Alexander Schranz
  • 2,154
  • 2
  • 25
  • 42
6
votes
2 answers

How to use google cloud storage as Laravel 5 filesystem?

I'm developing an application that lets my users upload files, and I've made it works with "local" disk using filesystem feature, but now I want to migrate and use google Google Cloud Storage for it. It has been a lot difficult to find some useful…
5
votes
1 answer

Unable to retrieve the file_size for file on downloading storage file - Laravel

Just a simple question. Trying to download the storage file but I'm unable to download the file from the storage folder. Searched on google. Found two ways to download storage files. Tried both but in vain. return…
Faizan Kamal
  • 1,732
  • 3
  • 27
  • 56
5
votes
3 answers

How to test a route in Laravel that uses both `Storage::put()` and `Storage::temporaryUrl()`?

I have a route in Laravel 7 that saves a file to a S3 disk and returns a temporary URL to it. Simplified the code looks like this: Storage::disk('s3')->put('image.jpg', $file); return Storage::disk('s3')->temporaryUrl('image.jpg'); I want to write…
jelhan
  • 6,149
  • 1
  • 19
  • 35
1
2 3
8 9