Hello,
I would like to add a MIME to my project, but I think I'm doing something wrong. I want to upload a .msg file to the database, but apparently .msg files aren't allowed.
This is my upload function:
PHP Code:
private function _do_upload() {
if (isset($_FILES['attachement']) && is_uploaded_file($_FILES['attachement']['tmp_name'])) {
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png|zip|pdf|doc|docx|msg|txt|xls|xlsx|xml|csv';
$this->load->library('upload', $config);
if ($this->upload->do_upload('attachement')) {
return $this->upload->data();
} else {
$error = array('error' => $this->upload->display_errors());
var_dump($error);
var_dump($_FILES);
die();
return $error;
}
} else {
return null;
}
}
In the mimes.php file, I added this line to the array:
Code:
'msg' => array('application/vnd.ms-outlook','application/octet-stream')
I also edited my .htaccess file. It looks like this now:
Code:
Options +FollowSymLinks
RewriteEngine on
RewriteCond $1 !^(connect\.php|index\.php|images|assets|uploads|cgi-bin|robots\.txt|info\.php)
RewriteRule ^(.*)$ index.php/$1 [L]
<FilesMatch "^.ht">
order allow,deny
deny from all
</FilesMatch>
AddType application/vnd.ms-outlook msg
Next to that, I also edited my mimes.types file in the folder /etc/. I added this line of code:
Code:
application/vnd.ms-outlook msg
In the upload.php file in the function do_upload I added a popup box:
PHP Code:
$this->file_type = preg_replace("/^(.+?);.*$/", "\\1", $this->file_type);
$this->file_type = strtolower(trim(stripslashes($this->file_type), '"'));
echo "<script type='text/javascript'>alert('$this->file_type');</script>";
When it shows up, it says
Quote:cdf v2 document, corrupt: cannot read summary info
Can anyone help me, or point out what I'm doing wrong? It would help me out a lot!
Thanks in advance,
Walle