Welcome Guest, Not a member yet? Register   Sign In
CI4 image not found problem
#1

Inside the public folder I have a folder called "upload" which contains other sub folders that contain images.
I can't see any images from any of these paths:

https://website.com/upload/files/persona...ne/123.jpg

or

https://web.codigniter4.it/public/upload...ne/123.jpg

and also with relative url
Reply
#2

You can try <?= base_url("path/to/image.jpg"); ?>

No need to include public in the path above.
Reply
#3

(02-22-2022, 07:07 AM)seunex Wrote: You can try <?= base_url("path/to/image.jpg"); ?>

No need to include public in the path above.

Generate the same url: https://website.com/upload/files/persona...ne/123.jpg

so I still don't see the image
Reply
#4

Then the image is uploaded else where
Reply
#5

(This post was last modified: 02-22-2022, 11:20 AM by serialkiller.)

(02-22-2022, 10:10 AM)seunex Wrote: Then the image is uploaded else where

No, the image is already present in the folder, I am converting a project from CI3 to CI4, I assume that also for the upload there will be the same problem, but solved here should also be solved there.

Obviously the folders and the image are present but it is not reachable for some reason
Reply
#6

Let assume ur upload path is located in the public. Any time u see base_url() it already point to the public. I found no reason why the image should not be rechargeable.

Try

<?= FCPATH.'path/to/image.jpg'; ?>

This will return the system relative path.
Reply
#7

If the file exists in a directory that is DOCUMENT_ROOT, the URL matches the path and the file is not returned, then you need to look for the problem in the web server settings.
Reply
#8

(02-22-2022, 12:37 PM)iRedds Wrote: If the file exists in a directory that is DOCUMENT_ROOT, the URL matches the path and the file is not returned, then you need to look for the problem in the web server settings.

The problem is that the version in CI3 runs on the same ecosystem and the images are visible, the only thing that changes is the version of CI, so I don't think it can be a web server setting
Reply
#9

CodeIgniter, like any other framework, will not be used if the URL specifies an existing file in the web server directory.
Reply
#10

(02-23-2022, 02:04 AM)iRedds Wrote: CodeIgniter, like any other framework, will not be used if the URL specifies an existing file in the web server directory.

I didn't understand the answer, however it was my mistake, I made a mistake in setting the $baseURL variable, now everything works, thanks
Reply




Theme © iAndrew 2016 - Forum software by © MyBB