Welcome Guest, Not a member yet? Register   Sign In
Upload files
#1

[eluser]drago_[/eluser]
Hello. I want to use the upload class to upload all types of files, but i cant do.

What i've done was (I've used the sample in the guide and modified a little) :
$config['allowed_types'] = 'bat|cpt|xlsx|word|xl|eml|... all extensions ...|gif|jpg|png';


The strange thing is that it upload only images like the original code.
Thanks.

Ps: sorry for my english. Is not my native language.
#2

[eluser]Clooner[/eluser]
The easiest thing to do is to use a MY_upload to overwrite the function is_allowed_filetype() to always return true!
#3

[eluser]CI_avatar[/eluser]
i have found that problem too. please simply omit the is_allowed_filetype().
#4

[eluser]drago_[/eluser]
Indeed that worked. Thanks.
#5

[eluser]SpooF[/eluser]
Is this a bug that should be or maybe already is reported?
#6

[eluser]drago_[/eluser]
I saw a solution to this problem. You modify the upload.php file form library directory:
Code:
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;
        }
        
        if (in_array("*", $this->allowed_types))  
        {  
            return TRUE;  
        }        

        $image_types = array('gif', 'jpg', 'jpeg', 'png', 'jpe');

        foreach ($this->allowed_types as $val) //...
.
Then you can use like this:
Code:
$this->load->library('upload', $config);
      $this->upload->set_allowed_types('*');


It's working fine. The only problem is that you dont have a progress bar or something to echo the progress. And i cant find scripts for this problem.




Theme © iAndrew 2016 - Forum software by © MyBB