⚠ In case you've missed it we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This forum is read-only and soon will be archived. ⚠

Akshay Hegde

Member Since 22 Dec 2014
Offline Last Active Sep 14 2015 09:54 AM

#12910 Grocery_Crud_Multiuploader library

Posted Akshay Hegde on 28 July 2015 - 07:52 AM

Hi  Akshay, I've got the same issue @neoblack has:


The issue presents when inside the $crud you set either callback_before_insert or callback_before_update like

         ->callback_before_insert(array($this,'my_callback')    )   
         ->callback_before_update(array($this,'other_callback')    )  ;

When added to crud, the uploads are correct, however, when saving data and returning to list view, the value for filelds set as upload type will have a null value, in other words, files url are not being saved as field values


You would get "No files" as value in view list


If I comment these callbacks everything works fine.


How to solve the callback issue?


Hi Sorry for late reply, I was out of station, this issue has been fixed in current release, it was due to callback override


Go through github, let me know if you find any difficulties







#12764 Grocery_Crud_Multiuploader library

Posted Akshay Hegde on 07 July 2015 - 06:06 AM

Okay,   please open application/config/mimes.php and add types like below, I think you are using CI < 3.0.0 that is why mp4 type is missing in mimes.php

 'mp4'   =>    'video/mp4',

Here is a content of mimes.php

[akshay@localhost config]$ cat mimes.php 
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
| -------------------------------------------------------------------
| -------------------------------------------------------------------
| This file contains an array of mime types.  It is used by the
| Upload class to help identify allowed file types.

return array('hqx'	=>	array('application/mac-binhex40', 'application/mac-binhex', 'application/x-binhex40', 'application/x-mac-binhex40'),
				'cpt'	=>	'application/mac-compactpro',
				'csv'	=>	array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'text/plain', 'application/csv', 'application/excel', 'application/vnd.msexcel', 'text/x-c'),
				'bin'	=>	array('application/macbinary', 'application/mac-binary', 'application/octet-stream', 'application/x-binary', 'application/x-macbinary'),
				'dms'	=>	'application/octet-stream',
				'lha'	=>	'application/octet-stream',
				'lzh'	=>	'application/octet-stream',
				'exe'	=>	array('application/octet-stream', 'application/x-msdownload'),
				'class'	=>	'application/octet-stream',
				'psd'	=>	'application/x-photoshop',
				'so'	=>	'application/octet-stream',
				'sea'	=>	'application/octet-stream',
				'dll'	=>	'application/octet-stream',
				'oda'	=>	'application/oda',
				'pdf'	=>	array('application/pdf', 'application/x-pdf', 'application/x-download','application/x-download', 'binary/octet-stream', 'application/unknown', 'application/force-download'),
				'ai'	=>	'application/postscript',
				'eps'	=>	'application/postscript',
				'ps'	=>	'application/postscript',
				'smi'	=>	'application/smil',
				'smil'	=>	'application/smil',
				'mif'	=>	'application/vnd.mif',
				'xls'	=>	array('application/excel', 'application/vnd.ms-excel', 'application/msexcel', 'application/vnd.ms-office'),
				'ppt'	=>	array('application/powerpoint', 'application/vnd.ms-powerpoint', 'application/vnd.ms-office'),
				'pptx'	=>	array('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/zip'),
				'wbxml'	=>	'application/wbxml',
				'wmlc'	=>	'application/wmlc',
				'dcr'	=>	'application/x-director',
				'dir'	=>	'application/x-director',
				'dxr'	=>	'application/x-director',
				'dvi'	=>	'application/x-dvi',
				'gtar'	=>	'application/x-gtar',
				'gz'	=>	'application/x-gzip',
				'gzip'  =>	'application/x-gzip',
				'php'	=>	'application/x-httpd-php',
				'php4'	=>	'application/x-httpd-php',
				'php3'	=>	'application/x-httpd-php',
				'phtml'	=>	'application/x-httpd-php',
				'phps'	=>	'application/x-httpd-php-source',
				'js'	=>	'application/x-javascript',
				'swf'	=>	'application/x-shockwave-flash',
				'sit'	=>	'application/x-stuffit',
				'tar'	=>	'application/x-tar',
				'tgz'	=>	array('application/x-tar', 'application/x-gzip-compressed'),
				'xhtml'	=>	'application/xhtml+xml',
				'xht'	=>	'application/xhtml+xml',
				'zip'	=>	array('application/x-zip', 'application/zip', 'application/x-zip-compressed'),
				'mid'	=>	'audio/midi',
				'midi'	=>	'audio/midi',
				'mpga'	=>	'audio/mpeg',
				'mp2'	=>	'audio/mpeg',
				'mp3'	=>	array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'),
				'aif'	=>	array('audio/x-aiff', 'audio/aiff'),
				'aiff'	=>	array('audio/x-aiff', 'audio/aiff'),
				'aifc'	=>	'audio/x-aiff',
				'ram'	=>	'audio/x-pn-realaudio',
				'rm'	=>	'audio/x-pn-realaudio',
				'rpm'	=>	'audio/x-pn-realaudio-plugin',
				'ra'	=>	'audio/x-realaudio',
				'rv'	=>	'video/vnd.rn-realvideo',
				'wav'	=>	'audio/x-wav',
				'bmp'	=>	array('image/bmp', 'image/x-windows-bmp'),
				'gif'	=>	'image/gif',
				'jpeg'	=>	array('image/jpeg', 'image/pjpeg'),
				'jpg'	=>	array('image/jpeg', 'image/pjpeg'),
				'jpe'	=>	array('image/jpeg', 'image/pjpeg'),
				'png'	=>	array('image/png',  'image/x-png'),
				'tiff'	=>	'image/tiff',
				'tif'	=>	'image/tiff',
				'css'	=>	'text/css',
				'html'	=>	'text/html',
				'htm'	=>	'text/html',
				'shtml'	=>	'text/html',
				'txt'	=>	'text/plain',
				'text'	=>	'text/plain',
				'log'	=>	array('text/plain', 'text/x-log'),
				'rtx'	=>	'text/richtext',
				'rtf'	=>	'text/rtf',
				'xml'	=>	array('application/xml', 'text/xml'),
				'xsl'	=>	'text/xml',
				'mpeg'	=>	'video/mpeg',
				'mpg'	=>	'video/mpeg',
				'mpe'	=>	'video/mpeg',
				'qt'	=>	'video/quicktime',
				'mov'	=>	'video/quicktime',
				'avi'	=>	array('video/x-msvideo', 'video/msvideo', 'video/avi', 'application/x-troff-msvideo'),
				'movie'	=>	'video/x-sgi-movie',
				'doc'	=>	'application/msword',
				'docx'	=>	array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip'),
				'odt'	=>	array('application/vnd.oasis.opendocument.text'),
				'xlsx'	=>	array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/zip'),
				'word'	=>	array('application/msword', 'application/octet-stream'),
				'xl'	=>	'application/excel',
				'eml'	=>	'message/rfc822',
				'json'  =>	array('application/json', 'text/json'),
				'pem'   =>	array('application/x-x509-user-cert', 'application/x-pem-file', 'application/octet-stream'),
				'p10'   =>	array('application/x-pkcs10', 'application/pkcs10'),
				'p12'   =>	'application/x-pkcs12',
				'p7a'   =>	'application/x-pkcs7-signature',
				'p7c'   =>	array('application/pkcs7-mime', 'application/x-pkcs7-mime'),
				'p7m'   =>	array('application/pkcs7-mime', 'application/x-pkcs7-mime'),
				'p7r'   =>	'application/x-pkcs7-certreqresp',
				'p7s'   =>	'application/pkcs7-signature',
				'crt'   =>	array('application/x-x509-ca-cert', 'application/x-x509-user-cert', 'application/pkix-cert'),
				'crl'   =>	array('application/pkix-crl', 'application/pkcs-crl'),
				'der'   =>	'application/x-x509-ca-cert',
				'kdb'   =>	'application/octet-stream',
				'pgp'   =>	'application/pgp',
				'gpg'   =>	'application/gpg-keys',
				'sst'   =>	'application/octet-stream',
				'csr'   =>	'application/octet-stream',
				'rsa'   =>	'application/x-pkcs7',
				'cer'   =>	array('application/pkix-cert', 'application/x-x509-ca-cert'),
				'3g2'   =>	'video/3gpp2',
				'3gp'   =>	'video/3gp',
				'mp4'   =>	'video/mp4',
				'm4a'   =>	'audio/x-m4a',
				'f4v'   =>	'video/mp4',
				'aac'   =>	'audio/x-acc',
				'm4u'   =>	'application/vnd.mpegurl',
				'm3u'   =>	'text/plain',
				'xspf'  =>	'application/xspf+xml',
				'vlc'   =>	'application/videolan',
				'wmv'   =>	'video/x-ms-wmv',
				'au'    =>	'audio/x-au',
				'ac3'   =>	'audio/ac3',
				'flac'  =>	'audio/x-flac',
				'ogg'   =>	'audio/ogg',
				'pages' =>      'application/zip',
				'numbers' =>    'application/zip',
				'svg'  =>	'image/svg+xml',
				'webm' => 'video/webm',
				'ogg'  => 'video/ogv'

/* End of file mimes.php */

#12701 Grocery_Crud_MultiSearch library for Flexigrid

Posted Akshay Hegde on 29 June 2015 - 12:00 PM

Hi ! Guys


This is my second small library which extends existing grocery_crud library this made my work easy so I just wanted to share with you guys, so that you can also make use of it. If If anyone wants to improve you are most welcome.


Please use below link to use the same





Guys I have plan to work on cookies (for multisearch) after sometimes, as I am busy with some project, please let me know difficulties you experienced, if any  or any useful feedback / suggestion for further improvements




Thank you


Akshay Hegde

#12542 Grocery_Crud_Multiuploader library

Posted Akshay Hegde on 01 June 2015 - 07:18 AM

The error which you have seen is related to php version, if you can upgrade php, then it will be alright


currently I am working on

[akshay@localhost tmp]$ php --version
PHP 5.5.14 (cli) (built: Jun 27 2014 11:23:47) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies

Please upgrade php and try this attachment



Attached Files

#12370 How to set default value in dropdown during add state

Posted Akshay Hegde on 17 April 2015 - 04:20 AM

Try this

              // Get state
	       $state = $crud->getState(); 

              // Call render function
               $output = $crud->render();

               if($state == 'add')
		$js='<script>$(\'select[name="status"] option[value="3"]\').attr("selected", "selected");</script>';
		$output->output .= $js;	


#12226 Grocery_Crud_Multiuploader library

Posted Akshay Hegde on 11 March 2015 - 11:44 AM

thanks for shared!!! :D


You are welcome.

#11984 Is there any callback for search fields ???

Posted Akshay Hegde on 24 December 2014 - 02:29 PM

Hi ! Peter Thanks for your feedback on my first post, I don't know whether you could solve your problem or not, as Amit Shah said there is no straight forward solution

available, but it can be achieved something like this, I did it in one of my projects, might help you too :)


Please note since we are comparing numbers (user_id), this method may not give you good search results, for example if you search amit, it will return user_id 2, which is ok, suppose if you just search letter 'a', we actually expect it to list both amit and akshay, it will just return user_id 2 as it finds first in given array, so I will not tell that this method is best, its just a hint for you

In your controller create  function or array which contains user_id and and user name, which looks something like this

/* do your db stuffs and return array */
function _get_users()
	// Do your db stuffs here
	return array(
			1 => 'Peter',
			2 => 'Amit Shah',
			3 => 'Akshay',
			4 => 'John',
			5 => 'Dummy'

and another small function which compares partially for example

/* Compare if there is any match partially return user id, else some bad numbers */ 
function compare_user($search=NULL)
        foreach($this->_get_users() as $k => $v)
            if(strpos(strtolower($v),strtolower($search)) !== false){
                    return $k;
        return -99;

Finally modify $_POST array, remaining things GC does :)

function test()


// If search field is user then do this
if(in_array($crud->getState(),array("ajax_list","ajax_list_info")) &&  array_key_exists("search_field",$this->input->post() ) )
     if($this->input->post("search_field") === "user_id" && strlen($this->input->post("search_text")) )
            $_POST["search_text"] = $this->compare_user($_POST["search_text"]);


#11973 Grocery_Crud_Multiuploader library

Posted Akshay Hegde on 22 December 2014 - 03:20 PM

Hi ! Guys


This is my first post on this forum, I wrote small library which extends existing grocery_crud library this made my work easy so  I just wanted to share with you guys, you can also make use of it.


Please use below link to use the same






Thank you all.