Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

AbdulBazith's avatar

images are shown in local system but not in live laravel?

Guys iam working with a project.

i have hosted my project in cpanel like this

1)coppied the whole project in xyz.com folder 2) and then moved all the items including index file from public folder to outer folder xyz.com

then opened the index.php file

i changed these two lines from this

require __DIR__.'/../vendor/autoload.php';
$app = require_once __DIR__.'/../bootstrap/app.php';

to this


require __DIR__.'/vendor/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';

is this right?? but the project is running correctly in live.

so i have images in storage folder linked with public folder using symlink.

in local i use this <img src="{{ asset('storage/'.$showques->attachment)}}"> this shows the image in local view. but when i move to live i need to add the public folder like this <img src="{{ asset('public/storage/'.$showques->attachment)}}"> then only it working correctly.

i know that if the imagesfolder is outsidethe public folder then it works correctly.

whats the problem? is my procedure is right??

and even for pdf it not showing any link for download. i have a condition like below

  @if (pathinfo($showques->attachment, PATHINFO_EXTENSION) ==
                'docx'||pathinfo($showques->explanation_attachment, PATHINFO_EXTENSION) == 'pdf')

                <a href="../public/storage/{{ $showques->explanation_attachment }}" target="_blank">VIEW DOCUMENT</a>

if it is a pdf or docs then it should a link so that user can download. in local works fine but in live eventhoug i add public folder it not working why?

0 likes
1 reply

Please or to participate in this conversation.