Simple file upload with other input fields not working - 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: Simple file upload with other input fields not working (/showthread.php?tid=24614) |
Simple file upload with other input fields not working - El Forum - 11-14-2009 [eluser]Unknown[/eluser] Hello Experts, Trying to implement 'file upload' with other input fields .. file upload without other fields is working fine but with other fields the form is not executing once i click on the 'submit' button in the form. Kindly help me out, thanks in advance. View Code <html> <head> <title>Upload Form</title> </head> <body> <?php echo $error;?> <?php echo form_open_multipart('upload/do_upload');?> <h5>Upload Image</h5> <input type="file" name="userfile" size="20" /> <h5>Text Field</h5> <input type="text" name="var1" size="20" /> <br /><br /> <input type="submit" value="upload" /> </form> </body> </html> Controller code <?php class Upload extends Controller { function Upload() { parent::Controller(); $this->load->helper(array('form', 'url')); } function index() { // echo "<BR>".$path."<BR>"; $this->load->view('form_upload', array('error' => ' ' )); } function do_upload() { $this->load->model('mproducts'); $path = $_SERVER["DOCUMENT_ROOT"].'/ciprojects/ibmcibasics/system/application/uploads/'; $config['upload_path'] = $path; $config['allowed_types'] = 'gif|jpg|png'; $config['max_size'] = '100'; $config['max_width'] = '1024'; $config['max_height'] = '768'; $this->load->library('upload', $config); if ( ! $this->upload->do_upload()) { $error = array('error' => $this->upload->display_errors()); $this->load->view('form_upload', $error); } else { $data = array('upload_data' => $this->upload->data()); // $this->mproducts->entry_insert(); $this->load->view('upload_success', $data); } } } ?> Simple file upload with other input fields not working - El Forum - 12-03-2009 [eluser]Marlon Souza[/eluser] swiftguy121, Good Morning, is missing the fildname Upload try this <input type="file" id="userfile" name="userfile"> |