Skip to content
Advertisement

Images not loading in CodeIgniter, image path correct error 403

I have an application where I save the image path in the database. I have a method Uploads

function uploads($path) 
{
    echo base_url('application/uploads/'.$path);   
    return true;
}

//base url is $config[‘base_url’] = ‘https://localhost/salon’;

$path is taken from the image

 style="background-image: url(<?php uploads('gallery/'.$gImage['imgPath']);?>)"

This is how i set the background image.

The error I get is 403 forbidden access when I try to open the image.

I also tried echo out the src and this is what I get https://prnt.sc/16ofw1m

I don’t know where that 1 at the end comes from but in src as seen in inspect element there is no 1 https://prnt.sc/16ogce3

Advertisement

Answer

The problem was in my htaccess file, I just commented out this lines>

#<IfModule authz_core_module>
#    Require all denied
#</IfModule>
#<IfModule !authz_core_module>
#    Deny from all
#</IfModule>

It took me a while to notice they were there.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement