Welcome Guest, Not a member yet? Register   Sign In
Image display and .htaccess

Here is my line of code below which displays an image from the uploads folder within the application folder using base_url()
<div id = "picture">
  <img id = "main" src = "&lt;? echo base_url() . 'application/uploads/default.jpg'; ?&gt;" alt = "profilepic"/>

And this is my htaccess file located at the root directory of my CI installation

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /tutorial/

    # Checks to see if the user is attempting to access a valid file,
    # such as an image or css document, if this isn't true it sends the
    # request to index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]

<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php

The problem is the image does not display. Instead, it displays the alt text. Is there something wrong with my htaccess? Did I miss something? Thanks for any help in advance!

There is an .htaccess file in the application folder that prevents you from putting static assets such as images in it. It's best to place your uploads folder at the root of your application, e.g. the folder where index.php is.

thank you sir Aken for the replyill go try it now

Theme © iAndrew 2016 - Forum software by © MyBB