I am a beginner here so pardon me for this question am using return File::put($path , $data);
to create a file in public folder on Laravel. I used this piece of code from controller I need to know the value of $path
how should it be.
For reference: // Path to the project's root folder echo base_path(); // Path to the 'app' folder echo app_path(); // Path to the 'public' folder echo public_path(); // Path to the 'storage' folder echo storage_path(); // Path to the 'storage/app' folder echo storage_path('app');
Run rm -r public_html . This command will delete public_html folder and all its contents. Make symbolic link ln -s $(pwd)/laravel/public $(pwd)/public_html . $(pwd) will be substituted with absolute path from root of the server.
The best way to retrieve your public folder path from your Laravel config is the function: $myPublicFolder = public_path(); $savePath = $mypublicPath. "enter_path_to_save"; $path = $savePath. "filename.
Use public_path()
For reference:
// Path to the project's root folder echo base_path(); // Path to the 'app' folder echo app_path(); // Path to the 'public' folder echo public_path(); // Path to the 'storage' folder echo storage_path(); // Path to the 'storage/app' folder echo storage_path('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