Welcome Guest, Not a member yet? Register   Sign In
file uploading with text and description
#12

[eluser]solid9[/eluser]
controller: partial codes only
Code:
<?php
class Gallery extends CI_Controller {

//Data type declaration
var $gallery_path;
var $gallery_path_url;

    function __construct() {
        parent::__construct();
  
  //load classes
  $this->load->model('Gallery_model');
  
  //variable data assignment
  $this->gallery_path = realpath(APPPATH . '../images');
  $this->gallery_path_url = base_url().'images/';
    }
Where is your step 1?

model:
Code:
<?php
class Gallery_model extends CI_Model {


function store_image_db($data) {
  
   $data = array(
     'id' => $this->input->post('id'),
     'title' => $this->input->post('title'),
     'description' => $this->input->post('description'),
     'path' => $image_data['full_path'],
     'thumb_path'=> $image_data['file_path'] . 'thumbs/'. $image_data['file_name']
  
  );
  
     if($this->db->insert('photos', $data)
     {
   return TRUE;
  }
  else
  {
   return FALSE;
  }
}

}

Also I don't think putting your image_upload codes inside the index is a good idea.
Better create a custom name for the image_upload method.




Messages In This Thread
file uploading with text and description - by El Forum - 11-09-2012, 10:40 PM
file uploading with text and description - by El Forum - 11-09-2012, 11:09 PM
file uploading with text and description - by El Forum - 11-10-2012, 06:42 AM
file uploading with text and description - by El Forum - 11-10-2012, 11:18 PM
file uploading with text and description - by El Forum - 11-11-2012, 03:42 AM
file uploading with text and description - by El Forum - 11-11-2012, 11:49 AM
file uploading with text and description - by El Forum - 11-11-2012, 02:31 PM
file uploading with text and description - by El Forum - 11-11-2012, 09:07 PM
file uploading with text and description - by El Forum - 11-11-2012, 09:20 PM
file uploading with text and description - by El Forum - 11-12-2012, 01:51 AM
file uploading with text and description - by El Forum - 11-12-2012, 05:43 AM
file uploading with text and description - by El Forum - 11-12-2012, 05:42 PM



Theme © iAndrew 2016 - Forum software by © MyBB