Level 50
It looks like you're trying to copy an existing file?
// Copy
Storage::copy('old/file1.jpg', 'new/file1.jpg');
// Move
Storage::move('old/file1.jpg', 'new/file1.jpg');
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
The docs state this:
//Storing Files
//The put method may be used to store a file on disk. You may also pass a PHP resource to the put method, which will use Flysystem's underlying //stream support. Using streams is greatly recommended when dealing with large files:
//Storage::put('file.jpg', $contents);
//Storage::put('file.jpg', $resource);
I am looking to save a file larger than my php memory limit (512MB), so when I do this, I get a memory error:
Storage::put('destinationfolder/file.jpg', Storage::get('originfolder/file.jpg'));
FatalErrorException in Local.php line 128: Allowed memory size of 536870912 bytes exhausted (tried to allocate 377028088 bytes).
How do I use the streaming functionality as indicated in the docs?
Please or to participate in this conversation.