Had this working but just updated my website on the server and it seems to have made all my uploaded files head to my public folder in my project rather than the public_html. Any idea on which file i must have uploaded and the fix?
-
are you tested that ? – Ahmed Shams Feb 06 '18 at 02:56
2 Answers
You said you had it working before. Was that on the same server...live?
If so, then could that be a server issue and not necessarily laravel issue? Maybe you should ask your host for help and clarifications about what changed?
If you are convinced it was about what you changed...then care to show us?
Ideally if the server is cpanel, you will want to upload all your laravel files into your home's directly...then all your /public
folder content into public_html
It will look like this:
.cpanel/
app/
- etc/
- bootstrap/
- mail/
- public_html/
- content from your laravel
/public
directory
- content from your laravel
- vendor/
...etc
You also need to go into your /public_html
and edit the index.php
content:
require __DIR__.’/../vendor/autoload.php’;
$app = require_once __DIR__.’/../bootstrap/app.php’;
And make sure it points to the correct location of your bootstrap folder..if you follow the structure above, then its ok.
Lastly, confirm that your PHP is indeed >= PHP7.0

- 1,321
- 16
- 11
-
i've check all of them but mine still uploaded on my project folder not my public_html... – Akbar Noto Jul 03 '19 at 00:50
-
Hi @AkbarNoto I fixed this issue thanks to the solution posted here: https://stackoverflow.com/a/50261573/3475551 – Eaweb Nov 12 '19 at 10:30
With help from this answer: https://stackoverflow.com/a/50261573/3475551
I managed to get laravel to save uploaded files to my servers public directory instead of app/public.
Edit app/Providers/AppServiceProvider.php
like this:
public function register()
{
$this->app->bind('path.public', function() {
return realpath(base_path().'/../../public_html');
});
}
Hope this helps.

- 811
- 1
- 12
- 16