Friday 15 March 2013

Codeigniter Modular HMVC extension - cant upload file -



Codeigniter Modular HMVC extension - cant upload file -

i have problem uploading files form. everytime try, error "file type not allowed". using hmvc modular extension , controllers extends mx_controller.

i tried $var_dump($_files) form-view , result fine, when seek utilize method do_upload() in controller doesnt work.

does have idea? here controller:

class store_data extends mx_controller

{

function __construct() { parent::__construct(); } function upload_pic() { //$data['item_id'] = $item_id; $template = "bootstrap_theme"; //$current_url = current_url(); //$data['form_location'] = $current_url; $data['view_file'] = "upload_pic"; $this->load->module('template'); $this->template->$template($data); } function do_upload() { //var_dump($_files); $config['upload_path'] = './images/'; $config['allowed_types'] = 'gif|jpg|png'; $config['max_size'] = '10000'; $config['max_width'] = '4024'; $config['max_height'] = '4768'; $this->load->library('upload', $config); $this->upload->overwrite = true; $this->upload->initialize($config); if ( ! $this->upload->do_upload()) { $data['error'] = $this->upload->display_errors(); $template = "bootstrap_theme"; $data['view_file'] = "upload_pic"; $this->load->module('template'); $this->template->$template($data); } else { $data['upload_data'] = $this->upload->data(); $template = "bootstrap_theme"; $data['view_file'] = "upload_success"; $this->load->module('template'); $this->template->$template($data); } }

and here upload form view:

<?php echo $error;?> <?php echo form_open_multipart('store_data/do_upload');?> <input type="file" name="userfile" size="20" /> <br /><br /> <input type="submit" value="upload" /> </form>

i solved problem. had uncomment extension=php_fileinfo.dll in php.ini , comment ;extension=php_mime_magic.dll

thanks anyway

codeigniter file-upload hmvc

No comments:

Post a Comment