Jump to content

shiva478

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

shiva478's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. opens up the form. It's part of the codeigniter framework.
  2. 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>
  3. I got it to work. It was the index.php that codeigniter uses that was making problems.
  4. I found out how to use the debugger in google chrome and I noticed that it didn't have anything. In my test page where I tried out the ckeditor I get a whole bunch of stuff that I can't post because it exceeds the word limit, which shows nothing and I know for a fact that the paths are correct
  5. I'm using google chrome and it's not on a public server yet. At the moment I'm using wamp
  6. I downloaded the ckeditor and I followed their instruction on how to install and how to get it to work. It's not the paths because I triple checked it to make sure. And that's why I'm not understanding why it's happening.
  7. Hi I'm trying to get ckeditor to work in my website but it isn't working. I have tried it as a test sample and it works fine but when I try to put it in my website it doesn't work and I don't know what I'm doing wrong. This is the test sample that I was trying out <html> <head> <script src="ckeditor/ckeditor.js"></script> </head> <body> <textarea class="ckeditor" name="content" </textarea> </body> </html> and this is my website's view <html> <head> <script src="ckeditor/ckeditor.js"></script> <title>Upload Form</title> </head> <h2>Create a bra 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>
  8. Thanks I will do that
  9. shiva478

    view image

    Hi I'm new to php and codeigniter. I was doing a tutorial on file uploading class in http://codeigniter.com/user_guide/libraries/file_uploading.html I was able to insert the image path into my database. The only problem I have is that I want to view the images on the upload_success view and I'm not sure how I go about doing that. The only thing I can get is a list of information about the image. This is my upload controller <?php class Upload extends CI_Controller { function __construct() { parent::__construct(); $this->load->model('upload_model'); $this->load->helper(array('form', 'url')); } function index() { $this->load->view('upload_form', array('error' => ' ' )); } function do_upload() { $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('upload_form', $error); } else { $data = array('upload_data' => $this->upload->data()); $upload_info = $this->upload->data(); $insert_data = array( 'id' => $this->input->post('id'), 'image_path' => $upload_info['file_path'] ); $this->db->insert('image', $insert_data); $this->load->view('upload_success', $data); } } } ?> This is my upload_model <?php class Upload_model extends CI_Model { public function __construct() { $this->load->database(); } public function get_upload() { $query = $this->db->get('image'); } } ?> This is my upload_form view <html> <head> <title>Upload Form</title> </head> <body> <?php echo $error;?> <?php echo form_open_multipart('upload/do_upload');?> <input type="file" name="userfile" size="20" /> <br /><br /> <input type="submit" value="upload" /> </form> </body> </html> and this is my upload_success view <html> <head> <title>Upload Form</title> </head> <body> <h3>Your file was successfully uploaded!</h3> <ul> <?php foreach ($upload_data as $item => $value):?> <li><?php echo $item;?>: <?php echo $value;?></li> <?php endforeach; ?> </ul> <p><?php echo anchor('upload', 'Upload Another File!'); ?></p> <?php endforeach; ?> </body> </html>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.