New: Learn Statamic on Laracasts!

We've retired the forum in favor of GitHub Discussions.

New conversations can be started on GitHub. Existing conversations will remain for a while longer.

Head over to GitHub →

How to access an asset container's filesystem?

Taylor Collins February 28, 2019 by Taylor Collins

The documentation here https://docs.statamic.com/addons/api/api-file talks about working with files in a filesystem. What disk (or other method) should I use to get an S3 Asset Container's file? I've tried the following:

File::disk('assets')->put($filename, get_file_contents($contents));
File::disk('asset-container-name-here')->put($filename, get_file_contents($contents));

But they result in the following exception being thrown:

InvalidArgumentException in FilesystemManager.php line 109:
Driver [] not supported.

The documentation here https://docs.statamic.com/knowledge-base/filesystems states that "Each asset container gets its own filesystem. Now you can put them on S3, for example." However, it doesn't elaborate on how to access a specific asset container's filesystem using either of the following:

  • Statamic\API\File
  • Statamic\API\Storage
Answered by Jason Varga!
>>>>>>> Answered <<<<<<<
2 Replies
2 Followers