Permalink
Browse files

Added the allowed file type back to 2.1/develop as I believe it was r…

…emoved

accidentally as Streams uses it
  • Loading branch information...
1 parent 2059051 commit c700caa6484e9fb5fa915613e40e9b95bd4a07d1 @jerel jerel committed Aug 1, 2012
Showing with 9 additions and 4 deletions.
  1. +9 −4 system/cms/modules/files/libraries/Files.php
@@ -317,7 +317,7 @@ public static function delete_folder($id = 0)
* @param bool $ratio Keep the aspect ratio or not?
* @return array|bool
*/
- public static function upload($folder_id, $name = FALSE, $field = 'userfile', $width = FALSE, $height = FALSE, $ratio = FALSE)
+ public static function upload($folder_id, $name = FALSE, $field = 'userfile', $width = FALSE, $height = FALSE, $ratio = FALSE, $allowed_types = FALSE)
{
if ( ! $check_dir = self::check_dir(self::$path))
{
@@ -341,12 +341,17 @@ public static function upload($folder_id, $name = FALSE, $field = 'userfile', $w
if ($folder)
{
- ci()->load->library('upload', array(
+ $upload_config = array(
'upload_path' => self::$path,
- 'allowed_types' => self::$_ext,
'file_name' => self::$_filename,
'encrypt_name' => config_item('files:encrypt_filename')
- ));
+ );
+
+ // If we don't have allowed types set, we'll set it to the
+ // current file's type if allowed in the config file.
+ $upload_config['allowed_types'] = ($allowed_types) ? $allowed_types : self::$_ext;
+
+ ci()->load->library('upload', $upload_config);
if (ci()->upload->do_upload($field))
{

0 comments on commit c700caa

Please sign in to comment.