• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Weird Thing When Uploading docx


Recently I found weird thing. So I make upload class, and the problem is with docx file.

The mime of the docx is like this
'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip','application/haansoftdocx','application/x-zip'),
My application is running normal in the local computer, but It failed in live server.

So, I look at base\libraries\Upload.php file, and make a modification

if (is_array($mime))
   if (in_array($this->file_type, $mime, TRUE))
    return TRUE;
                break;  // I add Break
elseif ($mime == $this->file_type)
    return TRUE;

So my question is, can somebody explain why in live server I need those break?

Quote:Local Server : PHP 5.2.6
Live Server : PHP 5.2.8

Another thing, my browser recognize the file as application/vnd.openxmlformats-officedocument.wordprocessingml.document but CI recognize it as 'application/x-zip'

You don't. You must be barking up the wrong tree. Once you return anything, the current method/function is exited. That break will never get hit. Try changing it to die() or exit(), and you'll see that it's never executed. I suspect it's something else that's fixed it.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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