-1

I have a fundraising platform built with Laravel 5.4. I've been successful in removing the public from the URL and hiding both the .env and composer.json files from view, but I can't upload an avatar to the upload/avatar folder from the admin or user account because Laravel produces a public/uploads/avatar folder and uploads the avatar into it instead of into the upload/avatar folder where it needs to go.

I have tried updating routes and usercontroller but to no avail. I'm not sure where to look now.

Can someone help me out with telling me where I go to change the code so Laravel no longer produces a public/uploads/avatar folder when I upload an avatar so the avatar goes into the upload/avatar folder instead?

Thanks.

Razoo
  • 1
  • 1
  • try checking at config/filesystems.php. care to show your code for the upload? – Jerico Pulvera Sep 20 '17 at 00:11
  • Delete the symbolic link between storage/public and public folders – wbail Sep 20 '17 at 00:24
  • I don't have the code, I'm trying to find the code within Laravel 5.4 to change the action of Laravel producing a public/uploads/avatar folder so the avatars upload to the upload/avatar folder. – Razoo Sep 20 '17 at 00:27
  • 'Delete the symbolic link between storage/public and public folders' Ok thanks I will look around for that. – Razoo Sep 20 '17 at 00:29
  • ok, so, I can't find where the symbolic link between storage/public and public folders is. I have basically no experience with Laravel so please explain to me in a little more detail. Thanks. – Razoo Sep 20 '17 at 01:12
  • Here is my code: 'public' => [ 'driver' => 'local', //'root' => storage_path('app/public'), 'root' => public_path(), 'url' => env('APP_URL').'/storage', 'visibility' => 'public', – Razoo Sep 20 '17 at 01:15
  • I mean the store code. how do you store the file. something like $request->file('file')->store('/upload'); – Jerico Pulvera Sep 20 '17 at 01:26

1 Answers1

0

In Filesystems.php

Change this:

'public' => [
     'driver' => 'local',
     'root'   => public_path(),
],

To this:

'public' => [
    'driver' => 'local',
    'root'   => '/',
],
wbail
  • 536
  • 1
  • 7
  • 18
Jerico Pulvera
  • 1,032
  • 7
  • 15
  • Noob Beginner I changed the code to you post and nothing has changed. Laravell still reproduces the public folder. Thanks any way. – Razoo Sep 20 '17 at 01:21
  • @Razoo where does it reproduce the public folder? run composer dumpautoload then try again. Is it uploading to the public/public/uploads or public/uploads ? – Jerico Pulvera Sep 20 '17 at 01:23
  • It reproduces the public folder in the root. Sorry Noob Beginner but I am a true noob beginner. This is my first time working with Laravel so I'm not familiar with composer. – Razoo Sep 20 '17 at 01:27
  • just run 'composer dumpautoload' in command line at your laravel project root directory – Jerico Pulvera Sep 20 '17 at 01:28
  • @ Jerico Pulvera, apparently running composer is beyond my abilities at the moment. It's ok though. I just added the app.url to the templates img src elements and it works fine for user, but not admin. – Razoo Sep 20 '17 at 02:16
  • @Razoo what is stored in your $user_avatar variable? – Jerico Pulvera Sep 20 '17 at 02:20