Laravel Storage link is not working in Hostinger Shared Hosting

Viewed 37

I've hosted my Laravel 7 website on Hostinger shared hosting. I use this route Route::get('/linkstorage', function() { Artisan::call('storage:link'); }); to link my storage folder public_html/storage with public_html/public/storage

But the link which is generated say's "Directory not found".

Directory /public_html/public//home/u907022978/domains/saifkhalilhardware.com/public_html/storage/app/public not found

I also tried using the below symlink, but it also did not work.

$targetFolder = $_SERVER['DOCUMENT_ROOT'].'/public_html/storage/app/public';
$linkFolder = $_SERVER['DOCUMENT_ROOT'].'/public_html/public/storage';
symlink($targetFolder,$linkFolder);

Please suggest how I can connect my storage link.

Regards,

[here's the image which shows the project's structure] 1

0 Answers
Related