My image upload option is not working in my codeigniter application.How can i get solve this?

Tharindu Sandaruwan

I have a problem like this in my website. I have created a option to upload a image. I have search for so many times but i didn't get a solution.

This the code in my view file.

               <div class="form-group">
                            <label for="exampleFormControlFile1"><p>4 : Media * :</p></label>
                           <p> <input type="file"  name="file_name">
               </div>

This the code in my controller.

public function create(){
        $config['upload_path'] = './uploads/';
        $config['allowed_types'] = 'jpg|png|jpeg';
        $this->load->library('upload', $config);
        $this->upload->do_upload('file_name');


        $file_name=$this->upload->data();
        $data=array(
            'institute'=>$this->input->post('institute'),
            'category'=>$this->input->post('category'),
            'content'=>$this->input->post('content'),
            'relavent_authority'=>$this->input->post('relavent_authority'),
            'multimedia'=>$file_name['file_name'],
            'created'=>date("Y-m-d H:i:s"),
        );

            $data['id']=$this->Question_model->add_data($data);
            $data['authority'] = $this->Question_model->getAuthority();
            if($this->input->post('share')=="yes"){
                $this->load->view('header',$data);
                $this->load->view('questions/share',$data['id']);
                $this->load->view('footer');
            }
     }   

For the uploaded file i have create a folder called uploads. But uploading is not working. It is not giving error either. What is the problem with this code?

Gooner

Try this on your form tag by adding "enctype"

<form action="upload.php" method="post" enctype="multipart/form-data">

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

how can i get the working path of my image in codeigniter when uploading

From Java

How can i show wordpress post in my codeigniter application?

From Dev

How can I pass an id of "0" into my application url? (Codeigniter)

From Dev

How can I pass an id of "0" into my application URL? (CodeIgniter)

From Dev

How can I get my ad banner to the bottom of my application?

From Dev

How can I show my image in codeigniter base_url

From Dev

How i can upload an image with CreateView on my post?

From Dev

How can i upload image with ajax in codeigniter?

From Dev

Java FXML: Why is my imageView not Showing, and how can I upload an image from my computer?

From Dev

How can i solve my bootstrap grid?

From Dev

How can I get the Bluetooth working on my Lenovo Yoga 3?

From Dev

How can i get my ListBox working correctly

From Dev

How can I get my framebuffer console working?

From Dev

How can I get my session id working

From Dev

How can I get my application database offline?

From Dev

How can I get my Application bound to port 161?

From Dev

How can I get the URL of my image in Picasso

From Dev

How can i get my location google image?

From Dev

How can i upload my website?

From Dev

How can I add name, caption etc in my uploaded image to facebook in my android application?

From Dev

how can i solve this error in my win32 reading image file code

From Dev

How do I add an image to my application

From Dev

How can I upload and retrieve images from my iOS application through Firebase?

From Dev

How can I display an image from my database to a view page in CodeIgniter?

From Dev

i have used image as navbar brand in my header but the image comes out of the header how can i solve this in bootstrap?

From Dev

Image Upload Core MVC PHP: How can I append my successfully passed data in function in controller

From Dev

How can I get my text to hug around the top of my image?

From Dev

How can I find my working directory?

From Dev

How do I get my sound working?

Related Related

  1. 1

    how can i get the working path of my image in codeigniter when uploading

  2. 2

    How can i show wordpress post in my codeigniter application?

  3. 3

    How can I pass an id of "0" into my application url? (Codeigniter)

  4. 4

    How can I pass an id of "0" into my application URL? (CodeIgniter)

  5. 5

    How can I get my ad banner to the bottom of my application?

  6. 6

    How can I show my image in codeigniter base_url

  7. 7

    How i can upload an image with CreateView on my post?

  8. 8

    How can i upload image with ajax in codeigniter?

  9. 9

    Java FXML: Why is my imageView not Showing, and how can I upload an image from my computer?

  10. 10

    How can i solve my bootstrap grid?

  11. 11

    How can I get the Bluetooth working on my Lenovo Yoga 3?

  12. 12

    How can i get my ListBox working correctly

  13. 13

    How can I get my framebuffer console working?

  14. 14

    How can I get my session id working

  15. 15

    How can I get my application database offline?

  16. 16

    How can I get my Application bound to port 161?

  17. 17

    How can I get the URL of my image in Picasso

  18. 18

    How can i get my location google image?

  19. 19

    How can i upload my website?

  20. 20

    How can I add name, caption etc in my uploaded image to facebook in my android application?

  21. 21

    how can i solve this error in my win32 reading image file code

  22. 22

    How do I add an image to my application

  23. 23

    How can I upload and retrieve images from my iOS application through Firebase?

  24. 24

    How can I display an image from my database to a view page in CodeIgniter?

  25. 25

    i have used image as navbar brand in my header but the image comes out of the header how can i solve this in bootstrap?

  26. 26

    Image Upload Core MVC PHP: How can I append my successfully passed data in function in controller

  27. 27

    How can I get my text to hug around the top of my image?

  28. 28

    How can I find my working directory?

  29. 29

    How do I get my sound working?

HotTag

Archive