简体   繁体   中英

Images not appearing in hostgator but appearing in localhost

I have a set of uploaded images in a members folder in a root directory. When the page loads the images are not showing up. When I inspect the element, I got a picture name and other parameters correctly but the picture doesn't show up.

This is the output image i'm getting

This is the result of inspect element

I used the same code in localhost and it's working fine and all the images are loaded up. But now that I switched to hostgator it doesn't show the image.

<tr style="color:grey; font-size:15px;">
    <td width="1%"><? echo $headdata['USERID']; ?></td>
    <td width="1%"><img src="/members/<? echo $headdata['USERPIC']; ?>" width="150" height="150"  ></td>
    <td width="1%"><? echo $headdata['NAME'];?></td>
    <td width="1%"><? echo $headdata['AGE'];?></td>
    <td width="1%"><? echo $headdata['SEX'];?></td>
    <td width="1%"><? echo $headdata['MOBILE'];?></td>
    <td width="1%"><? echo $headdata['TYPE'];?></td>

    <?
        $txtreceived = $headdata['ID'];
        $IDS = encrypt_decrypt('encrypt', $txtreceived);
    ?>

    <td width="1%">
        <a href="editmemberdetails.php?UpdateId=<? echo $IDS; ?>" class="btn    btn-sm btn-primary">
            <i class="fa fa-pencil"></i>
        </a>
        <a href="editmember.php?UpdateId=<? echo $IDS; ?>" class="btn btn-sm btn-danger">
            <i class="fa fa-times"></i>
        </a>
    </td>
</tr>

If your code in hostgator is not in root directory (www or public_html) and in your local host your code is in www root or public_html then your path of src not working on server because you have added / in src="/members/..."

so please check it with src="./members/..." still not working then check members folder permission in server it should be readable and writable 755 for apache user. and check file which is $headdata['USERPIC']; is exist in members folder?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM