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

One response

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 ….

तुमचा अभिप्राय नोंदवा

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / बदल )

Twitter picture

You are commenting using your Twitter account. Log Out / बदल )

Facebook photo

You are commenting using your Facebook account. Log Out / बदल )

Google+ photo

You are commenting using your Google+ account. Log Out / बदल )

Connecting to %s




%d bloggers like this: