I have a question relating to Laravel, where is the File::put()
stored in Laravel?
I have checked inside storage/app/public
and the content isn't there.
From Laravel official documentation. The storage directory contains compiled Blade templates, file based sessions, file caches, and other files generated by the framework. This folder is segregated into app, framework, and logs directories. The app directory may be used to store any files utilized by your application.
If you have file object from request then you can simply get by laravel function. $extension = $request->file->extension(); dd($extension); If you have file object from request then you can simply get by laravel function.
To upload files to storage in Laravel, use MAMP or XAMPP as a local web server, define a database name in MySQL, and add the correct configuration in the . env file.
To store files in folder storage/app
, you must use Storage
class as:
Storage::disk('local')->put('file.txt', 'Contents');
then it would store a file in storage/app/file.txt
.
Docs
File::put
store in public
folder
for example .In this case file.txt will be created in public folder
File::put('file.txt', 'contents is written inside file.txt');
Also you can use Storage class
Storage::put( 'file.txt','contents is written inside file.txt' );
This will create file inside storage\app
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With