Welcome Guest, Not a member yet? Register   Sign In
(Help) Problem with uploading a flv format file with CI 1.7 get some errors even with the right codes
#1

[eluser]ebot[/eluser]
i will be grateful for any help on this codes of mine. Every time i try uploading a flv video file i get this error message: the file type is not allowed, but i did add the flv format on the allow_type config stuff, here are the codes
everything has been specified, so i don't know why i'd get the errors
Code:
function uploadVideo()
  {
        
          
            $config['upload_path'] = './videos/';
            $config['allowed_types'] = 'flv';
            $config['max_size']    = '50940';
            
            //form set up
            $rules['name']    = "required";
              
            $fields['name']  = 'name';  
              
            $this->validation->set_rules($rules);
            $this->validation->set_fields($fields);    
          
            
            // check whether form has been run and validates
            if ($this->validation->run() == FALSE)
            {
                
                $this->session->set_flashdata('notice','Your video was not been uploaded!');
                redirect('manage/addVideo');
            }
            //else yes so do upload
            else
            {
                
                
                
            $this->load->library('upload', $config);
                //if upload not success display errors
                if ( ! $this->upload->do_upload())
                {
                    $data['error'] = $this->upload->display_errors();
                    
                      $this->load->view('admin/addvideo', $data);      
                }
                //else do form insert, image upload and image resize!!
                else
                {        
                //upload data
                $data['upload_data'] = $this->upload->data();
              
            
                $image=$data['upload_data']['orig_name'];
                
                $this->videoM->newVideo($image, $_POST);  
                
                $this->session->set_flashdata('message','Your video has been uploaded');
                redirect('manage/video');
                
                }    
                
            }        
    
                
                
            
              
            
  }
#2

[eluser]Dam1an[/eluser]
When you process the upload, do
Code:
print_r($this->upload->data());
That will give you the mime type, make sure you have that as one of the mime types for the flv extension in the config file (mimes.php)




Theme © iAndrew 2016 - Forum software by © MyBB