• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Add MIME (upload .msg file)


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'
            if (
$this->upload->do_upload('attachement')) {
            } else {
$error = array('error' => $this->upload->display_errors());
        } else {

In the mimes.php file, I added this line to the array:

'msg'    =>    array('application/vnd.ms-outlook','application/octet-stream')

I also edited my .htaccess file. It looks like this now:

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
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:

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), '"'));
"<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,


Maybe you don't have the right mime type... Did you first try to see if the file's mime type is the correct one? Try echoing it with PHP function mime_content_type($filepath). Also, did you take a look in here? http://stackoverflow.com/questions/17853...d-by-finfo

I tried echoing with mime_content_type, and I got 'CDF V2 Document, corrupt: Cannot read summary info' again. It does work for other files though (tried it with 'index.php', and it works with that).

I already checked that link before I asked my question here, if I add those lines into my .htaccess file, then I still get the same message: 'CDF V2 Document, corrupt: Cannot read summary info'. But my guess is, that the link is a solution for .docx files. Not for .msg files.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.