[eluser]Unknown[/eluser]
Hello everyone,
Long time reader, first time poster. I've got a very strange problem. Maybe you can help.
In a view I try to load a file (previously uploaded). I check if it exists first and if it does I then display it. Check the code.
Code:
<?php if (file_exists(base_url() . 'img/image.jpg')) : ?>
<img src="<?php echo base_url() . 'img/image.jpg'; ?>" />
<?php endif ; ?>
The problem is that the file_exists() function always returns FALSE even if I know for sure that given file does exist. For example this:
Code:
<?php if (file_exists(base_url() . 'img/image.jpg')) : ?>
<h2>file found:</h2>
<img src="<?php echo base_url() . 'img/image.jpg'; ?>" />
<?php else : ?>
<h2>file NOT found:</h2>
<img src="<?php echo base_url() . 'img/image.jpg'; ?>" />
<?php endif ; ?>
will display "file NOT found:" and draw the image anyway. I'm confused, please help. The /img/ catalog is already added to my .htaccess file.