3

imagedisplay.php(view)

  <html>
    <body>

    <h3>Your file was successfully uploaded!</h3>

    <?php  print_r($upload_data); ?>   </br>
    <?php  $str=base_url()."images/".$upload_data['file_name'] ?>  </br>
    <?php $str=str_replace('http://','',$str) ?>

    <?php echo $str; ?>  



        <img src= '$str'/>  </br>    

For echo $str; I got the string i need to display th image but when i pass it to img src.... i am not able to display it on the browswer

Is there any syntactical error or am i missing anything ...pls help?

1
  • change <img src="<?php echo $str; ?>"/> Commented Mar 22, 2014 at 12:43

1 Answer 1

3

Just a small syntax problem here. Embed PHP echo command in the HTML code, like so:

<img src="<?php echo $str; ?>"/>  </br>

or embed PHP echo short tags:

<img src="<?=$str?>"/>  </br>

In other words: insert the PHP output at the positions, where you need it as HTML content.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.