How to upload PDF file with CodeIgniter

21 01 2010

Open <root_directory>/system/application/config/mimes.php file

Change value of ‘pdf’ element of $mimes array

$mimes = array( ‘hqx’   =>      ‘application/mac-binhex40’,
‘cpt’   =>      ‘application/mac-compactpro’,
‘csv’   =>      array(‘text/x-comma-separated-values’, ‘text/comma-separated-values’, ‘application/octet-stream’, ‘application/vnd.ms-excel’, ‘text/csv’, ‘application/csv’, ‘application/excel’, ‘application/vnd.msexcel’),
‘bin’   =>      ‘application/macbinary’,
‘dms’   =>      ‘application/octet-stream’,
‘lha’   =>      ‘application/octet-stream’,
‘lzh’   =>      ‘application/octet-stream’,
‘exe’   =>      ‘application/octet-stream’,
‘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’),

To

‘pdf’   =>      array(‘application/pdf’, ‘application/x-pdf’, ‘application/x-download’,’application/x-download’, ‘binary/octet-stream’, ‘application/unknown’, ‘application/force-download’),


अंमलबजावणी

Information

१ प्रतिसाद

5 02 2010
starcoder

For Multiple files uploading

load upload library once.
$this->load->library(‘upload’);

Set the different configurations for each file, initialize it and upload the file.
$config[‘upload_path’] = ;
$config[‘allowed_types’] = ;
$config[‘max_size’] = ; // Set 0 to get default value from php.ini
$this->upload->initialize($config);
$this->upload->do_upload();

&

$config[‘upload_path’] = ;
$config[‘allowed_types’] = ;
$config[‘max_size’] = ; // Set 0 to get default value from php.ini
$this->upload->initialize($config);
$this->upload->do_upload();

&

$config[‘upload_path’] = ;
$config[‘allowed_types’] = ;
$config[‘max_size’] = ; // Set 0 to get default value from php.ini
$this->upload->initialize($config);
$this->upload->do_upload();

and so on ….

Leave a reply to starcoder उत्तर रद्द करा.