CodeIgniter Forums
Weird Thing When Uploading docx - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Weird Thing When Uploading docx (/showthread.php?tid=57417)



Weird Thing When Uploading docx - El Forum - 03-13-2013

[eluser]pengenbelajarCI[/eluser]
Hi,

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

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


Weird Thing When Uploading docx - El Forum - 03-13-2013

[eluser]TheFuzzy0ne[/eluser]
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.