Jump to content


A Multi - MultiUpload

upload multiple multiple upload multiupload multi multiupload

  • Please log in to reply
26 replies to this topic

#1 Amit Shah

Amit Shah

    grocery CRUD Master

  • Advanced Member
  • PipPipPip
  • 1,192 posts
  • LocationMumbai, India

Posted 14 September 2014 - 08:28 AM

First of all - i will like to say sorry to Peter - he waited for this solution for quite sometime but it was unfortunate for me and situation that i couldnt help with 1st my health then with my laptops health.

 

Okies-  This 1 was an enhanced version of Victors - multi upload solution. It was a great solution in itself but GOD guided me to a better one where i have had a requirement for a multi multiple upload in a single form and have had a need to achieve it with GC. I am so much in love with GC - it was too tough for me to even think of leaving out GC just to achieve such small solution.

so there it was ...i am attaching the solution. Following is the structure of the same

application

      |->config

             |->cache.php

     |->controllers

             |->artists.php       ----This is the sample controller giving you the example of how to use the component

             |->uploaders

                       |->artists_photo_uploader.php        ---- A sample uploader configuration to be used in the application with controller

                       |->gigs_photo_uploader.php        ---- A sample uploader configuration to be used in the application with controller

                       |->uploader.php          --- This is the base uploader functionality extracted and generalized on ground of solution provided by Victor

      |->libraries

              |->cache.php               ---- This is required piece of code cuz for me session storage failed.

 

 

Now here is the explaination to all the stuff thats there

As described above .. the uploder.php is the base extracted functionality for any uploaders that needs to be for achieving the multi uploader functionality. The only difference between the multiple uploaders is a certain set of values that are extracted as configuration values. You can find the same into the sample uploader configuration files shared in the application. But a base information about the configuration that u might need to play around with .. are here

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

require_once('uploader.php');     //include the base uploader class 

class Artists_photo_uploader extends Uploader {         //extend the same. This is necessary for achiving the multi multiupload functionality.
	protected $path_to_uploade_function = 'uploaders/artists_photo_uploader/multi_uploade'; // path to function call. 
   	private $files = array();              //Required to just declare for managing the files that gets uploaded
	protected $default_css_path = 'assets/styles/';             //Path to the CSS
	protected $default_javascript_path = 'assets/scripts/';              //Path where the scripts will be stored / found
	protected $path_to_directory = 'assets/artists/';                       //Path where the files will get uploaded
	// table description
	protected $file_table = 'artist_pictures';              //Name of the table where the files will get stored
	protected $category_id_field = 'artist_id';          //ID of the master table relation (foreign key)
	protected $file_name_field = 'picture';              //Name of the field that stores the filename
	protected $primary_key = 'id';                          //Primary key 
	protected $allowed_types = 'gif|jpeg|jpg|png';            //Defination of the file types allowed - necessary requirement for u to control the type of content you set for uploading the files.

	function __construct() {
		parent::__construct();		
	}
}

The above configuration are clear to explain itself. Please dont ask me to explain how the base  uploader class works - it is just the extract of Victors code.

 

Now in the controller...

	public function index() {
		
		try{
			$crud = new Grocery_crud();
			$crud->set_table('artists');
			$crud->set_subject('Artist');
			
			$crud->fields('title', 'description', 'pictures');

			require_once FCPATH . "application/controllers/uploaders/artists_photo_uploader.php";   
/* set the uploader needed to manage the upload. Now here we can set many uploaders as we need. 
*  i have currently just set 1 uploader only ... u can have many together ... thats the beauty of this extension
*/

			//Set the multi uploader functionality
			$artistsPhotoUploader = new Artists_photo_uploader();        //we need to have the object for the same.
//Nsex 2 lines are necvessary for gneerating the multi upload code
			$crud->callback_add_field('pictures', array($artistsPhotoUploader, 'add_upload_fied'));             
			$crud->callback_edit_field('pictures', array($artistsPhotoUploader, 'edit_upload_fied'));

//This callbacks are also necessary to be declared. Without it .. the application will faily in its totality.
//Both the callbacks are just to be declared as described below.
			$crud->callback_before_insert(array($this, '_set_files'));
			$crud->callback_after_insert(array($this, '_save_files_into_db'));
			$crud->callback_before_update(array($this, '_set_files'));
			$crud->callback_after_update(array($this, '_save_files_into_db'));

			$artistsPhotoUploader->set_js($crud);              //Set the js callbacks and stuff for individual uploader.
//In case u have had a video uploader also with this - u would have had to call the set_js for that object too.... for ex
// $artistVideoUploader->set_js($crud);

			$output = $crud->render();

			$this->load->view('crud.php',$output);
	
		}catch(Exception $e){
			show_error($e->getMessage().' --- '.$e->getTraceAsString());
		}
	}
		
	function _set_files($post_array) {
		require_once FCPATH . "application/controllers/uploaders/artists_photo_uploader.php";
		$photo_uploader = new Artists_photo_uploader();
		$photo_uploader->_set_files($post_array);

//as described above - in case of multi-multi uploader u will need to have the same declaraion for other uploaders too... for ex.
/*******
*                require_once FCPATH . "application/controllers/uploaders/artists_video_uploader.php";
*		$video_uploader = new Artists_video_uploader();
*		$video_uploader->_set_files($post_array);
*/
//What this functionality dose is - it will grab all the files that are uploaded by the user - store the values for the same into a cached file. Yes - here for me the session storage failed .. hence i had to take cache in use. Thats why u see a cache.php library above in the code. then it just removes the values and the upload field defined.
	}

	function _save_files_into_db($post_array, $primary_key) {
		require_once FCPATH . "application/controllers/uploaders/artists_photo_uploader.php";
		$photo_uploader = new Artists_photo_uploader();
		$photo_uploader->_save_files_into_db($post_array, $primary_key);
//Here - u need to follow the same steps as shared in the function above. This will store the uploaded objects into its respective tables.
	}

PHEW ----- thats a lot of explaination that went in and hope it makes the picture whole lot more clear to all of you guys out there.. so happy (multi) - multiuploading.

 

and off course - Happy GCing :)

Attached Files



#2 Peter

Peter

    Member

  • Members
  • PipPip
  • 25 posts

Posted 15 September 2014 - 04:08 PM

Thank you so much Amit for your time... please upload libraries->cache.php, which is missing in zip file... I am so happy today...because of you dear..

 

Thank you once again....

 

-Peter P 



#3 Amit Shah

Amit Shah

    grocery CRUD Master

  • Advanced Member
  • PipPipPip
  • 1,192 posts
  • LocationMumbai, India

Posted 16 September 2014 - 06:51 AM

well sorry if i missed it.. here u can download it from here

 

Sorry for missing that out :(

 

but Happy GCing :)

Attached Files



#4 Peter

Peter

    Member

  • Members
  • PipPip
  • 25 posts

Posted 16 September 2014 - 10:00 AM

Sir kindly share version of  GC and codeigniter you are using



#5 Peter

Peter

    Member

  • Members
  • PipPip
  • 25 posts

Posted 16 September 2014 - 11:01 AM

Dear Amit please find attachments, I have tried a lot to debug your code, unfortunately I could not fix the problem, here I am attaching my configuration, sql as well as view files, please help me to finish it

 

Thank you

 

Please look at here whenever I uncomment this its gives blank page

<?php

class Artist extends CI_Controller {

	function __construct() {
		parent::__construct();
		$this->load->library('session');	
		
	 	/* Standard Libraries of codeigniter are required */
        	$this->load->database();
        	$this->load->helper('url');

		/* crud table */
        	$this->load->library('grocery_CRUD');
		
	}
		
	public function index() {
		
		try{
			$crud = new grocery_CRUD();
			$crud->set_table('gallery');
			$crud->set_subject('Artist');
			
			$crud->fields('title', 'pictures');

			
			
			
			/*
			// <<<<<<<<<<<<<<< THIS COMMENTED PARTS NOT WORKING >>>>>>>>>>>>>>>>>>>

			require_once FCPATH . "application/controllers/uploaders/artists_photo_uploader.php";

			

			$artistsPhotoUploader = new Artists_photo_uploader();
			

			// Set the multi uploader functionality
			
			$crud->callback_add_field('pictures', array($artistsPhotoUploader, 'add_upload_fied'));
			$crud->callback_edit_field('pictures', array($artistsPhotoUploader, 'edit_upload_fied'));
			$crud->callback_before_insert(array($this, '_set_files'));
			$crud->callback_after_insert(array($this, '_save_files_into_db'));
			$crud->callback_before_update(array($this, '_set_files'));
			$crud->callback_after_update(array($this, '_save_files_into_db'));

			$artistsPhotoUploader->set_js($crud);
			$crud->unset_jquery();

			// <<<<<<<<<<<<<<< THIS COMMENTED PARTS NOT WORKING >>>>>>>>>>>>>>>>>>>

			*/
			
			$output = $crud->render();

			$this->load->view('crud.php',$output);
	
		}catch(Exception $e){
			show_error($e->getMessage().' --- '.$e->getTraceAsString());
		}
	}
		
	function _set_files($post_array) {
		require_once FCPATH . "application/controllers/uploaders/artists_photo_uploader.php";
		$photo_uploader = new Artists_photo_uploader();
		$photo_uploader->_set_files($post_array);
	}

	function _save_files_into_db($post_array, $primary_key) {
		require_once FCPATH . "application/controllers/uploaders/artists_photo_uploader.php";
		$photo_uploader = new Artists_photo_uploader();
		$photo_uploader->_save_files_into_db($post_array, $primary_key);
	}
}	

Attached Files



#6 Amit Shah

Amit Shah

    grocery CRUD Master

  • Advanced Member
  • PipPipPip
  • 1,192 posts
  • LocationMumbai, India

Posted 16 September 2014 - 12:03 PM

Give me a days time - i will patch with a fresh copy of GC and upload a complete working set ...

As for - there aint anything extra ordinary in the same but still i dont deny the fact that it is not functioning in @your end. So i will take some time 2 patch and give u a fresh / complete working copy.

 

As for me sharing my GC will be a tough situation as i keep on mentoring it to my needs. You might start finiding it difficult to use it just by extracting it and taking it in your project cuz many things are changed internally. So i will ... as recommended ... work upon a fresh copy of GC / CI downloaded.



#7 Peter

Peter

    Member

  • Members
  • PipPip
  • 25 posts

Posted 16 September 2014 - 12:17 PM

Sorry Brother I forgot to attach application folder, I am using latest GC v1.4.1 and codeigniter v2.2.0, Not sure about the issue sorry I know I am killing your time...



#8 Amit Shah

Amit Shah

    grocery CRUD Master

  • Advanced Member
  • PipPipPip
  • 1,192 posts
  • LocationMumbai, India

Posted 17 September 2014 - 07:32 AM

here - as promised

please find the running application sample with fresh vesion of GC / CI

yes - my mistake - i did fail to upload 1 more helper file (content helper) where i used the functionality to trim the file name &amp; make it unique. I have tested the same and it is properly functional so this should not be of any trouble to you to extract the stuff as is

1 more additional thing added was jquery mousewheel - script file .. i have added it.

make sure you have the proper set upload folder into the path as defined
in my case it is (assets/artists) - if it is not found - it will throw an error .. yes the error may end misguiding saying the upload type allowed is so and so... but the actual error is the statement before that. This one i have had kept it for the purpose of my debuging.

please find the zip file from here and here is the table structure of the sql in case any1 wants to run it straight as a demo
 

# Dump of table artist_pictures
# ------------------------------------------------------------

DROP TABLE IF EXISTS `artist_pictures`;

CREATE TABLE `artist_pictures` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `artist_id` int(11) DEFAULT NULL,
  `picture` varchar(255) DEFAULT NULL,
  `priority` int(11) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `artists`;

CREATE TABLE `artists` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(255) DEFAULT NULL,
  `description` text,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

Happy GCing :)
 

 



#9 Peter

Peter

    Member

  • Members
  • PipPip
  • 25 posts

Posted 19 September 2014 - 03:29 PM

Finally I am happy to inform you that I could able to see output today just now, Thanks a lot dear ... 



#10 Peter

Peter

    Member

  • Members
  • PipPip
  • 25 posts

Posted 19 September 2014 - 04:45 PM

do you have any idea why after clicking view button its showing upload field as well along with pictures ?  



#11 Amit Shah

Amit Shah

    grocery CRUD Master

  • Advanced Member
  • PipPipPip
  • 1,192 posts
  • LocationMumbai, India

Posted 20 September 2014 - 02:49 AM

Yes Peter .. i did notice that.. sorry i missed out the view section but i have altered the code and now it looks even better with a bit of gallery style of formatting. Where pictures align to each other side by side rather then one below the other. This one looks a bit better.

 

Secondly.. also will like you to download and replace the grocery crud library tooo cuz the original one still misses out the callback for read fields ... it eventually considers read to go along with edit fields which aint a good strategy.. and hence the functionality to set_read_fields or read_fields / unset_read_fields also added to the same...

 

now in the read fields .... it dose not have delete link / upload button .. just the list of images uploaded by the user.

 

Now is a better reason to do Happy GCing :)



#12 Amit Shah

Amit Shah

    grocery CRUD Master

  • Advanced Member
  • PipPipPip
  • 1,192 posts
  • LocationMumbai, India

Posted 20 September 2014 - 02:53 AM

one more thing. .. just a last reminder sort of .. for the files changed

 

1 - uploader.php

2 - Grocery_CRUD.php

3 - artist.php

 

For all those who have pulled in earlier version .. will request you to re-download it again from the link shared above or here and do make sure u replace the 1st 2 changed files and do make sure about the additional code into the controller wherever u have used it.

$crud->callback_read_field('pictures', array($artistsPhotoUploader, 'view_upload_fied'));

This will ensure you a proper read only picture listing functionality.

 

Happy GCing :)



#13 Peter

Peter

    Member

  • Members
  • PipPip
  • 25 posts

Posted 20 September 2014 - 07:16 AM

Thank you, latest one is working , what I wanted to convey you is as you can see in table picture fields remains empty, assume I uploaded 2 files, I want to write 2 files uploaded, if nothing is uploaded then empty something like that, and in read (view), I want to create download link something like this, I  hope you will understand

public function _callback_download_url($value, $row)
{
return "<a href='".site_url('asset/artist/'.$row->picture)."'>$value</a>";
} 

And 1 more idea I  have is instead of 2 table we can keep files in 1 table itself by saving array(base64 encode ) in picture field (text datatype) 

 

 

# convert array to string and save in database
public function _push_arr($arr){ return base64_encode(serialize($arr));}


# string to array 
public function _pop_arr($str){return unserialize(base64_decode($str));}
# count of array represents number of files uploaded

I am trying to understand this framework very soon I will come here to contribute something to community

 

Thank you...

 

 



#14 Peter

Peter

    Member

  • Members
  • PipPip
  • 25 posts

Posted 20 September 2014 - 07:37 AM

One problem solved modified function view_upload_fied

function view_upload_fied($value, $primary_key)
	{
		$files = $this->db->get_where($this->file_table, array($this->category_id_field => $primary_key))->result_array();
		
		$html = '<select name="' . $this->file_name_field . '_files[]" multiple="multiple" size="8" class="multiselect" id="' . $this->file_name_field . '_multiple_select" style="display:none;">';
		if (!empty($files))
		{
			foreach ($files as $items)
			{
				$html.="<option value=" . $items[$this->file_name_field] . " selected='selected'>" . $items[$this->file_name_field] . "</option>";
			}
		}
		$html.='</select>';
		$html.='<div id="' . $this->file_name_field . '_list_svc" class="mutiupload_list" style="margin-top: 40px;">';
		if (!empty($files))
		{

			$html .= "<table>";

			foreach ($files as $items)
			{
		
				$html .="<tr>";				
				
				if ($this->_is_image($items[$this->file_name_field]) === true)
				{
					$html.= '<td><div id="' . $items[$this->file_name_field] . '">';
					$html.= '<a href="' . base_url() . $this->path_to_directory . $items[$this->file_name_field] . '" class="image-thumbnail" id="fancy_' . $items[$this->file_name_field] . '">';
					$html.='<img src="' . base_url() . $this->path_to_directory . $items[$this->file_name_field] . '" height="50"/>';
					$html.='</a>';
					$html.='</div></td>';
				}
				else
				{
					$html.='<td><div id="' . $items[$this->file_name_field] . '" >
					<span>' . $items[$this->file_name_field] . '</span>
					</div></td>';
				}

					$html.='<td><a href="'.base_url() . $this->path_to_directory . $items[$this->file_name_field].'">Download</a></td>';

				$html .= "</tr>";

			}
				$html .= "</table>";
		}
		$html.='</div>';
		$html.=$this->JS();
		return $html;
	}

Now I want to write number of files uploaded in picture field.



#15 Amit Shah

Amit Shah

    grocery CRUD Master

  • Advanced Member
  • PipPipPip
  • 1,192 posts
  • LocationMumbai, India

Posted 20 September 2014 - 09:15 AM

well.. good work ... yes you can do the same as you wish to / please to.. but i felt managing it seperately made some sense as off @my end so left it apart ...

save files .. and write to database is the 1 where u need to alter the code.. where it 1 by 1 inserts into the system.. u can instead make a csv of the filenames and manage it that way.. do as you please :) ... the code is a base ground .. u can build the empire over it :)



#16 Peter

Peter

    Member

  • Members
  • PipPip
  • 25 posts

Posted 20 September 2014 - 10:49 AM

Thank you so much master, I could able to see what I wanted today.... I will update if I get any new problem.



#17 heruprambadi

heruprambadi

    Advanced Member

  • Members
  • PipPipPip
  • 83 posts
  • LocationIndonesia

Posted 12 October 2014 - 02:41 PM

One more thing. When we delete data, the file in assets/artists did not deleted. So did in artist_picture table. I think we need callback_after_delete function.



#18 Amit Shah

Amit Shah

    grocery CRUD Master

  • Advanced Member
  • PipPipPip
  • 1,192 posts
  • LocationMumbai, India

Posted 12 October 2014 - 03:22 PM

Yes - i do agree - sorry this part was missed by me too actually.. callback_after_delete is surely a good option to control / clear the images / pictures / etc.



#19 Amit Shah

Amit Shah

    grocery CRUD Master

  • Advanced Member
  • PipPipPip
  • 1,192 posts
  • LocationMumbai, India

Posted 13 October 2014 - 05:55 AM

Hello GC Fans,

 

Have re-uploaded a modified version which includes the callback_after_delete handler

 

if its a single instance of multi-file uploaded you using for then the artists.php (in the controller) have the sample call registered

$crud->callback_after_delete(array($artistsPhotoUploader, 'handle_row_delete'));

but in case u have multiple instance of file uploader .. then u need to manage making multiple calls .. something like the following example

      function _delete_files($primary_key) {
		require_once FCPATH . "application/controllers/uploaders/artists_photo_uploader.php";
		$photo_uploader = new Artists_photo_uploader();
		$photo_uploader->handle_row_delete($primary_key);
		
		require_once FCPATH . "application/controllers/uploaders/artists_video_uploader.php";
		$video_uploader = new Artists_video_uploader();
		$video_uploader->handle_row_delete($primary_key);
	}

For those who do not want to download the zip file again, heres the code required for the same

 

Add the following function call in application/controllers/uploaders/uploader.php

function handle_row_delete($primary_key) {
        $this->load->model('common_model', 'cModel');
        //Retrive all the rows from the table where the files uploaded are being recorded for.
        $rows = $this->cModel->getAllFor($this->file_table, $this->category_id_field, $primary_key);
        foreach ($rows as $row) {
            //Delete each uploaded file from backend
            $file = $row[$this->file_name_field];
            $final_path = $this->path_to_directory . $file;
            try {
                unlink($final_path);
            } catch (Exception $e) {
                //Even if there is an exception ... here we aint much bothered, like file dose not exists or whatever.
            }
            //Once the file is deleted ... delete that record from the table
            $this->cModel->delete($file_table, $this->primary_key, $row[$this->primary_key]);
        }
    }

Minimum code for the model required (create a model - common_model.php in models) [2 functions in actuality are required - getAllFor and delete -- in common_model]

<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

if(!class_exists('CI_Model')) { class CI_Model extends Model {} }

class Common_model extends CI_Model
{

       public function getAllFor($table, $fieldName, $value, $limit=false, $offset=0) {
		if($limit != false) {
			$this->db->limit($limit, $offset);
		}
		$this->db->where($fieldName, $value);
		$query = $this->db->get($table);
		$result = $query->result_array();
		return $result;
	}

       public function delete($table, $where=NULL) {
		if(is_null($where)) {
			throw Exception("Cannot delete all rows... need to specify where clause / condition");
		}
		$this->db->delete($table, $where);
	}
}

Happy GCing :)



#20 clustersblue

clustersblue

    Advanced Member

  • Members
  • PipPipPip
  • 40 posts

Posted 29 April 2015 - 01:58 AM

Hi Amit,

 

I tried to incorporate your multi upload into my project.  There might be something that I miss that it gives me an error.

<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">

<h4>A PHP Error was encountered</h4>

<p>Severity: Notice</p>
<p>Message:  Undefined index: ATTACHMENT_multi_aploade</p>
<p>Filename: uploaders/uploader.php</p>
<p>Line Number: 331</p>

</div>

Here is my controller code:

        try{
            $this->load->library('grocery_CRUD');  
            require_once APPPATH . "controllers/uploaders/artists_photo_uploader.php";
            $artistsPhotoUploader = new Artists_photo_uploader();
            $data['role_id']     = $this->role_id;
            $data['location_id'] = $this->location_id;
            $data['user_name']   = $this->user_name;
            $data['user_email']  = $this->user_email;
            $data['user_id']     = $this->user_id;
            $data['emp_num']     = $this->emp_num;
            $data['page_name']   = 'My Requests';
            $this->firephp->log($this->emp_num,"EMP_NUM");
            $crud = $this->grocery_crud;
            
            $crud->set_table('trms_request')
                 ->set_relation('CATEGORY_ID','trms_category','CATEGORY')
                 ->set_relation('REQ_STATUS_ID','trms_req_status','STATUS')
                 ->where('EMP_NUM',$this->emp_num)
                 ->set_subject('Request')
                 ->columns('REQUEST_ID','SHORT_DESC','IMPACT_PROCESS','NEED_BY_DATE','REQ_STATUS_ID')
                 ->add_fields('SHORT_DESC','CATEGORY_ID','DETAILED_DESC','IMPACT_PROCESS','IMPACT_NOT_IMPL','CURR_MNG_WO_TOOL','NEED_BY_DATE','ATTACHMENTS')
                 ->edit_fields('SHORT_DESC','CATEGORY_ID','DETAILED_DESC','IMPACT_PROCESS','IMPACT_NOT_IMPL','CURR_MNG_WO_TOOL','NEED_BY_DATE','ATTACHMENTS')
                 ->required_fields('CATEGORY_ID','SHORT_DESC','DETAILED_DESC','IMPACT_PROCESS','IMPACT_NOT_IMPL','CURR_MNG_WO_TOOL','NEED_BY_DATE')
                 ->display_as('REQUEST_ID','ID')
                 ->display_as('CATEGORY_ID','Category')
                 ->display_as('SHORT_DESC','Description')
                 ->display_as('DETAILED_DESC','Details')
                 ->display_as('IMPACT_PROCESS','How will this new tool/feature impact current processes?')
                 ->display_as('IMPACT_NOT_IMPL','What is the impact if tool/feature is not implemented?')
                 ->display_as('CURR_MNG_WO_TOOL','How are we currently managing without this tool/feature?')
                 ->display_as('NEED_BY_DATE','Needed by')
                 ->display_as('REQ_STATUS_ID','Status')
                 ->unset_read_fields('EMP_NUM','START_OF_WORK','EVAL_NOTES')
                 ->callback_after_insert(array($this, '_log_user_status_after_insert'))
                                
                 ->callback_add_field('ATTACHMENTS', array($artistsPhotoUploader, 'add_upload_fied'))
		 ->callback_edit_field('ATTACHMENTS', array($artistsPhotoUploader, 'edit_upload_fied'))
//		 ->callback_read_field('ATTACHMENTS', array($artistsPhotoUploader, 'view_upload_fied'))
		 ->callback_before_insert(array($this, '_set_files'))
		 ->callback_after_insert(array($this, '_save_files_into_db'))
		 ->callback_before_update(array($this, '_set_files'))
		 ->callback_after_update(array($this, '_save_files_into_db'))
                 ->callback_after_delete(array($artistsPhotoUploader, 'handle_row_delete'));
            
			
            $artistsPhotoUploader->set_js($crud);
            $output = $crud->render();
            $output->user_data = $data;
            $this->load->view('request_view',$output);
            
        }catch(Exception $e){
            show_error($e->getMessage().' --- '.$e->getTraceAsString());
        }

And my database dump

DROP TABLE IF EXISTS `trms_request`;
CREATE TABLE `trms_request` (
  `REQUEST_ID` int(11) NOT NULL AUTO_INCREMENT,
  `CATEGORY_ID` int(11) DEFAULT NULL,
  `SHORT_DESC` varchar(200) DEFAULT NULL,
  `DETAILED_DESC` mediumtext,
  `IMPACT_PROCESS` mediumtext,
  `IMPACT_NOT_IMPL` mediumtext,
  `CURR_MNG_WO_TOOL` mediumtext,
  `NEED_BY_DATE` date DEFAULT NULL,
  `EMP_NUM` int(11) DEFAULT NULL,
  `REQ_STATUS_ID` int(11) DEFAULT NULL,
  `START_OF_WORK` date DEFAULT NULL,
  `EVAL_NOTES` mediumtext,
  PRIMARY KEY (`REQUEST_ID`),
  KEY `EMP_NUM_idx` (`EMP_NUM`),
  KEY `CATEGORY_ID_idx` (`CATEGORY_ID`),
  CONSTRAINT `CATEGORY_ID` FOREIGN KEY (`CATEGORY_ID`) REFERENCES `trms_category` (`CATEGORY_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `EMP_NUM` FOREIGN KEY (`EMP_NUM`) REFERENCES `trms_users` (`EMP_NUM`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1 COMMENT='Main Table for Request.'; 


DROP TABLE IF EXISTS `trms_upload`;
CREATE TABLE `trms_upload` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `REQUEST_ID` varchar(45) DEFAULT NULL,
  `ATTACHMENT` varchar(255) DEFAULT NULL,
  `PRIORITY` int(11) DEFAULT '0',
  PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

 

 

I'm currently looking back your code and check if there are some misses.  Do you think there some?

 

By the way, I was able to upload files: the problem is when I submit/save the form.

 

Thanks,







Also tagged with one or more of these keywords: upload, multiple, multiple upload, multiupload, multi multiupload

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users