CodeIgniterのVer1.7.1でのファイルアップロードクラスに対応
MYNETS_Upload クラスを、CodeIgniterの1.7.1の対応(セキュリティ対策)に合わせて書き換えました。
変更箇所は次のメソッド
function is_allowed_filetype() { if (count($this->allowed_types) == 0 OR ! is_array($this->allowed_types)) { $this->set_error('upload_no_file_types'); return FALSE; } $image_types = array('gif', 'jpg', 'jpeg', 'png', 'jpe'); foreach ($this->allowed_types as $val) { $mime = $this->mimes_types(strtolower($val)); // Images get some additional checks // 20090716 CI Ver1.7.1に対応 if (in_array($val, $image_types)) { if (getimagesize($this->file_temp[$this->field]) === FALSE) { return FALSE; } } //////////////////////////////KUNIHARU Tsujioka if (is_array($mime)) { if (in_array($this->file_type[$this->field], $mime, TRUE)) { return TRUE; } //echo $this->file_type[$this->field]; //exit; } else { if ($mime == $this->file_type[$this->field]) { return TRUE; } } } return FALSE; }