Skip to content

Commit

Permalink
Added the allowed file type back to 2.1/develop as I believe it was r…
Browse files Browse the repository at this point in the history
…emoved

accidentally as Streams uses it
  • Loading branch information
jerel committed Aug 1, 2012
1 parent 2059051 commit c700caa
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions system/cms/modules/files/libraries/Files.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ public static function delete_folder($id = 0)
* @param bool $ratio Keep the aspect ratio or not? * @param bool $ratio Keep the aspect ratio or not?
* @return array|bool * @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)) if ( ! $check_dir = self::check_dir(self::$path))
{ {
Expand All @@ -341,12 +341,17 @@ public static function upload($folder_id, $name = FALSE, $field = 'userfile', $w


if ($folder) if ($folder)
{ {
ci()->load->library('upload', array( $upload_config = array(
'upload_path' => self::$path, 'upload_path' => self::$path,
'allowed_types' => self::$_ext,
'file_name' => self::$_filename, 'file_name' => self::$_filename,
'encrypt_name' => config_item('files:encrypt_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)) if (ci()->upload->do_upload($field))
{ {
Expand Down

0 comments on commit c700caa

Please sign in to comment.