shiva478 Posted August 27, 2012 Share Posted August 27, 2012 I have an upload form that has ckeditor, before I added the ckeditor to my website it was working, but now that I added the ckeditor nothing gets uploaded to the database. I don't understand why that is happening. This is my controller class Bras extends CI_Controller { public function __construct() { parent::__construct(); $this->load->helper('form'); $this->load->helper('url'); } function bra_create(){ $this->load->model('admin_model'); $this->load->helper('form'); $this->load->library('form_validation'); $data['title'] = 'Create a bra item'; /* $this->form_validation->set_rules('title', 'Title', 'required'); $this->form_validation->set_rules('content', 'content', 'required'); if ($this->form_validation->run() === FALSE) { //$this->load->view('templates/header', $data); $this->load->view('admin/bra_create'); //$this->load->view('templates/footer'); } else { $this->admin_model->set_bras(); $this->load->view('admin/success'); }*/ $config['upload_path'] = './uploads/'; $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('admin/bras/bra_create', $error); } else { $data = array('upload_data' => $this->upload->data()); $upload_info = $this->upload->data(); $slug = url_title($this->input->post('title'), 'dash', TRUE); $insert_data = array( 'bra_id' => $this->input->post('bra_id'), 'title' => $this->input->post('title'), 'slug' => $slug, 'image_path' => $upload_info['file_path'], 'filename' => $upload_info['file_name'], 'content' => $this->input->post('content'), 'price' => $this->input->post('price') ); $this->db->insert('bras', $insert_data); $this->load->view('admin/success', $data); } } This is my view <html> <head> <script src="../ckeditor/ckeditor.js"></script> <title>Upload Form</title> </head> <h2>Create a news item</h2> <?php echo validation_errors(); ?> <body> <?php echo form_open_multipart('admin/bra_create');?> Title: <br /><input type="text" name="title" /><br /> <input type="file" name="userfile" size="20" /><br /> Content: <br /><textarea class="ckeditor" name="content"></textarea><br /> Price: <br /><input type="text" name="price" /><br /> <input type="submit" value="Submit" /><br /> </form> <?php echo anchor('admin/bra_view', 'view'); ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/267666-upload-form-not-working/ Share on other sites More sharing options...
MMDE Posted August 27, 2012 Share Posted August 27, 2012 I can't seem to find an opening tag for the form tag in the HTML... Sorry if I'm missing something, but yeah, couldn't find: <form with a ctrl+f search of this page. Quote Link to comment https://forums.phpfreaks.com/topic/267666-upload-form-not-working/#findComment-1373044 Share on other sites More sharing options...
shiva478 Posted August 27, 2012 Author Share Posted August 27, 2012 <?php echo form_open_multipart('admin/bra_create');?> opens up the form. It's part of the codeigniter framework. Quote Link to comment https://forums.phpfreaks.com/topic/267666-upload-form-not-working/#findComment-1373045 Share on other sites More sharing options...
MMDE Posted August 27, 2012 Share Posted August 27, 2012 It would have been nice if you posted the entire html form. Anyways, could you set $config['max_size'] = '100'; to be: $config['max_size'] = '0'; Same with the width and height etc. 0 should do so there's no "limit". Also, it's kind of hard following the code when there's so many functions I got no idea what really does. You need to do some debugging, try to echo some data, and see how far in the code you get when you try to upload a file. Figure out where the problem is, and not post a long code that is hard to read. Quote Link to comment https://forums.phpfreaks.com/topic/267666-upload-form-not-working/#findComment-1373046 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.