rafaelg21's avatar

Problems with laravel base_path () upload imagen migrations

Good afternoon do a migration of my page to my server via cpanel. My itinerary continues.


laravel/   /* Laravel's Archives */
public_html/ 
       intranet/   /*Public archives */

Change my index.php files from the public folder and run laravel and it did not give me any problems everything worked well the links and estylos everything perfect.

require __DIR__.'/../bootstrap/autoload.php';

$app = require_once __DIR__.'/../bootstrap/app.php';

The problem is when I upload the image that gives me error is like that does not get the directory.

$upload_dir = public_path().'/images/profile/';

Who can help me please? Thank you so much

0 likes
1 reply
rafaelg21's avatar
rafaelg21
OP
Best Answer
Level 1

Solved. Modify the AppServiceProvider.php file that is located in the following directory: / app / Providers


 public function register()
   {   
       $this->app->bind('path.public', function(){
          return $_SERVER['DOCUMENT_ROOT']."/intranet";
       });
   }

Please or to participate in this conversation.