Welcome Guest, Not a member yet? Register   Sign In
cannot upload mp3 files on ci2 pls help
#1

[eluser]Pokhara[/eluser]
please help me, i can't upload mp3 on this code

Code:
//now upload images
        //some $config vars for image
        $config['upload_path'] = './images/articles';
        $config['allowed_types'] = 'mp3|gif|jpg|jpeg|png';
        $config['max_size'] = '0';
        $config['remove_spaces'] = true;
        $config['overwrite'] = false;
        $config['max_width'] = '0';
        $config['max_height'] = '0';
        
        $this->load->library('upload', $config);
        
        //upload main image
        if(!$this->upload->do_upload('a_image')){
            $e = $this->upload->display_errors();
            //print_r($e);
        }
        
        $image = $this->upload->data();
        if($image['file_name']){
            $data['a_image'] = "images/articles/". $image['file_name'];
        }
        
        unset($config);
        
        //now upload thumb
        //some $config vars for thumb
        $config['upload_path'] = './images/articles/thumb';
        $config['allowed_types'] = 'mp3|gif|jpg|jpeg|png|mp3|wav';
        $config['max_size'] = '0';
        $config['remove_spaces'] = true;
        $config['overwrite'] = false;
        $config['max_width'] = '0';
        $config['max_height'] = '0';    
        $this->upload->initialize($config);
        
        
        
        //upload thumbnail
            if(!$this->upload->do_upload('a_thumbnail')){
            $this->upload->dispaly_errors();    
        }        
        
        $thumb = $this->upload->data();
            if($thumb['file_name']){
            $data['a_thumbnail'] = "images/articles/thumb/". $thumb['file_name'];
        }
#2

[eluser]Taftse[/eluser]
maybe this could be your problem
https://bitbucket.org/ellislab/codeignit...-mime-type
#3

[eluser]Pokhara[/eluser]
that did not solve my problem
#4

[eluser]Unknown[/eluser]
Use multiple upload instead of do_upload

Quote:http://ellislab.com/forums/viewthread/71999/

the parameter of do_upload($field = 'userfile'),

$field only check if $_FILE[$field] exists
#5

[eluser]davidbehler[/eluser]
What does
Code:
echo $this->upload->display_errors();
show?
#6

[eluser]coderex[/eluser]
Hi,

Just found that Firefox 4 recognises mp3 as 'audio/x-amzaudio' for it's mime type, a new one on me. For security I would suggest renaming all files, to avoid filename.php.mp3.

list of mimes

'audio/mpeg','audio/mpeg3','audio/mpg','audio/x-mpeg','audio/mp3','audio/x-mpeg-3','audio/x-amzaudio'




Theme © iAndrew 2016 - Forum software by © MyBB