Codeigniter and Uploadify implementation

by gowtham 2010-09-17 11:25:16

1-YOUR VIEW FILE:

[removed][removed]
[removed][removed]
[removed][removed]
[removed]
$(document).ready(function() {
$("#uploadify").uploadify({
'uploader' : '<?=base_url()?>uploadify/scripts/uploadify.swf',
'script' : '<?=site_url('welcome/do_upload')?>',
'cancelImg' : '<?=base_url()?>uploadify/cancel.png',
'folder' : './uploads',
'queueID' : 'fileQueue',
'fileDataName':'userfile',
'auto' : false,
'multi' : true,
'fileExt': '*.jpg;*.jpeg;*.gif;*.png;',
'fileDesc' :'Please select Gif,JPG,PNG IMAGES',
'queueSizeLimit' :'20',
'buttonText': 'Uplaod Photo',
onComplete: function(event, queueID, fileObj, reposnse, data) {
// $('#filesUploaded').append(' alert(reposnse);
}

});
});
[removed]

2.CONTROLLER
function do_upload()
{
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '144400';
$config['max_width'] = '1024';
$config['max_height'] = '768';

$this->load->library('upload', $config);

if ( ! $this->upload->do_upload())
{
echo $this->upload->display_errors();

}
else
{
$data = array('upload_data' => $this->upload->data());

print_r($data);
}
}

3. config/mimes.php
'bmp' => array('image/bmp','application/octet-stream'),
'gif' => array('image/gif','application/octet-stream'),
'jpeg' => array('image/jpeg', 'image/pjpeg','application/octet-stream'),
'jpg' => array('image/jpeg', 'image/pjpeg','application/octet-stream'),
'jpe' => array('image/jpeg', 'image/pjpeg','application/octet-stream'),
'png' => array('image/png', 'image/x-png','application/octet-stream'),

1134
like
0
dislike
0
mail
flag

You must LOGIN to add comments