• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[solved] accessing images in the view (strange behaviour)

#1
[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="&lt;?php echo base_url() . 'img/image.jpg'; ?&gt;" />
&lt;?php endif ; ?&gt;

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:
&lt;?php if (file_exists(base_url() . 'img/image.jpg')) : ?&gt;
    <h2>file found:</h2>
    <img src="&lt;?php echo base_url() . 'img/image.jpg'; ?&gt;" />
&lt;?php else : ?&gt;
    <h2>file NOT found:</h2>
    <img src="&lt;?php echo base_url() . 'img/image.jpg'; ?&gt;" />
&lt;?php endif ; ?&gt;

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.


Messages In This Thread
[solved] accessing images in the view (strange behaviour) - by El Forum - 11-02-2009, 05:44 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.