summaryrefslogtreecommitdiffstats
path: root/system/libraries/Upload.php
diff options
context:
space:
mode:
authorpaulburdick <devnull@localhost>2007-06-24 22:29:09 +0200
committerpaulburdick <devnull@localhost>2007-06-24 22:29:09 +0200
commit2f35c4b91526d2d813601401a3e6563255f2b639 (patch)
treed3adb9c0bf9fa65b668bc5cd2b5828d713c5ff61 /system/libraries/Upload.php
parent3c5e373a2c95ba06b8d5b9820f53a72bea2f5681 (diff)
Modified the is_image() method in the Upload library to take into account Windows IE 6/7 eccentricities when dealing with MIMEs
Diffstat (limited to 'system/libraries/Upload.php')
-rw-r--r--system/libraries/Upload.php21
1 files changed, 16 insertions, 5 deletions
diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php
index 9d2bae2ae..fa1cf1e73 100644
--- a/system/libraries/Upload.php
+++ b/system/libraries/Upload.php
@@ -477,17 +477,28 @@ class CI_Upload {
*/
function is_image()
{
+ // IE will sometimes return odd mime-types during upload, so here we just standardize all
+ // jpegs or pngs to the same file type.
+
+ $png_mimes = array('image/x-png');
+ $jpeg_mimes = array('image/jpg', 'image/jpe', 'image/jpeg', 'image/pjpeg');
+
+ if (in_array($this->file_type, $png_mimes))
+ {
+ $this->file_type = 'image/png';
+ }
+
+ if (in_array($this->file_type, $jpeg_mimes))
+ {
+ $this->file_type = 'image/jpeg';
+ }
+
$img_mimes = array(
'image/gif',
- 'image/jpg',
- 'image/jpe',
'image/jpeg',
- 'image/pjpeg',
'image/png',
- 'image/x-png'
);
-
return (in_array($this->file_type, $img_mimes, TRUE)) ? TRUE : FALSE;
}