Solved: non-object error |
Hello,
I am trying to view the file image after uploading and I am getting non-object error. How to call the file name? upload_success.php Code: [code] <?php endforeach; ?> </ul> <img src="uploads/".$upload_data->file_name> <p><?php echo anchor('upload', 'Upload Another File!'); ?></p> </body> </html>[/code]
" If I looks more intelligence please increase my reputation."
Because it is an Associated array and your trying to access it as an object.
Do you even know the difference between an associated array or an object etc;? What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
associated array something like:
https://www.w3schools.com/php/php_arrays.asp ? How to fix the code?
" If I looks more intelligence please increase my reputation."
I already able to capture the file name but unable to print it out correctly.
controllers/upload_image.php $data = array('upload_data' => $this->upload->data(), 'file_name' => $this->upload->data('file_name') ); $this->photo_model->insert_pic(); $this->load->view('upload_success', $data); views/upload_success.php <img scr="uploads/"<?php echo $file_name; ?>> If I checked through inspect element I get this html code: <img src="uploads/"davy210.png=""> which is in correct.
" If I looks more intelligence please increase my reputation."
I finally find the answer to this one! Thanks.
<img src="<?php echo base_url('/uploads/'.$file_name); ?>">
" If I looks more intelligence please increase my reputation."
|
Welcome Guest, Not a member yet? Register Sign In |