29.07.2016 Views

laravel-5

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Filesystem / Cloud Storage 260<br />

.<br />

1 $time = Storage::lastModified('file1.jpg');<br />

Storing Files<br />

The put method may be used to store a file on disk. You may also pass a PHP resource to<br />

the put method, which will use Flysystem’s underlying stream support. Using streams is greatly<br />

recommended when dealing with large files:<br />

.<br />

1 Storage::put('file.jpg', $contents);<br />

2<br />

3 Storage::put('file.jpg', $resource);<br />

The copy method may be used to copy an existing file to a new location on the disk:<br />

.<br />

1 Storage::copy('old/file1.jpg', 'new/file1.jpg');<br />

The move method may be used to move an existing file to a new location:<br />

.<br />

1 Storage::move('old/file1.jpg', 'new/file1.jpg');<br />

Prepending / Appending To Files<br />

The prepend and append methods allow you to easily insert content at the beginning or end of a file:<br />

.<br />

1 Storage::prepend('file.log', 'Prepended Text');<br />

2<br />

3 Storage::append('file.log', 'Appended Text');

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!