File Upload Help - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: File Upload Help (/showthread.php?tid=53768) |
File Upload Help - El Forum - 08-08-2012 [eluser]malzahar[/eluser] I'm having trouble getting file uploads to work with my form. I made sure the upload folder permissions are correct (755) and the library looks to be configured properly but when I try to do an upload it just fails but does not return any errors. If anyone could take a look at this for me it would be much appreciated. Parts of the form that matters. Code: echo form_open_multipart('form/form_validate', $attributes); Part of the controller that matters Code: function form_validate() { File Upload Help - El Forum - 08-08-2012 [eluser]ppwalks[/eluser] Code: if ($this->upload->do_upload('product_thumb')) I had the same problem a week ago, prepare your do_upload like mine and all should be good File Upload Help - El Forum - 08-08-2012 [eluser]ppwalks[/eluser] Are you inserting into database, if so then make sure you pass thhe variable to the model, 'product_thumb' is the name of my input field File Upload Help - El Forum - 08-08-2012 [eluser]malzahar[/eluser] I'm inserting the other form data into a database and that appears to be working fine. Once the insert completes it goes to the upload code as shown below. Code: if($this->My_Data_Model->my_insert_function()) { After using $this->output->enable_profiler(TRUE); and viewing the post data it doesn't even show a value for $this->input->post('userfile') or in my $_FILES array so I'm not sure why the file isn't even being referenced. File Upload Help - El Forum - 08-08-2012 [eluser]ppwalks[/eluser] That is because you need to extract the data from the do_upload, do upload is an array so you need to extract the ['file_name'] as shown above and move into the variable, it should then show up File Upload Help - El Forum - 08-08-2012 [eluser]ppwalks[/eluser] The code above is not inserting yet I have to move the variable into the db File Upload Help - El Forum - 08-08-2012 [eluser]malzahar[/eluser] ah got it working thanks for your help! |