Answers for "laravel public folder not working"

PHP
1

how to store file in public folder laravel

You can create a new storage disc in config/filesystems.php
'public_uploads' => [
    'driver' => 'local',
    'root'   => public_path() . '/uploads',
],

And store files like this:

if(!Storage::disk('public_uploads')->put($path, $file_content)) {
    return false;
}
Posted by: Guest on December-12-2021
0

laravel get file in public folder

Storage::get('publicFileNameHere')
Posted by: Guest on January-07-2021
0

laravel project doesn't go into the public folder by itself

For Laravel 5:
Rename server.php in your Laravel root folder to index.php
Copy the .htaccess file from /public directory to your Laravel root folder.
That's it!


But this will make your system vulnerable


------------------------------------
 all you need to do is to put this code into the .htaccess file in 
  public


RewriteEngine On
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(.*)$ /public/$1 [L,QSA]
---------------------------------------
if it doesn't work just put a file namely index.html in root directory
and in side it put a script code 
like 
<script>
window.location.href = 'public/';
</script>
Posted by: Guest on May-02-2021

Code answers related to "laravel public folder not working"

Browse Popular Code Answers by Language