Welcome Guest, Not a member yet? Register   Sign In
Cant upload a video file to folder
#1

[eluser]rad11[/eluser]
Hello i have a problem with uploading file to folder.

I added mimes

Code:
'mp4'   =>      'video/mp4',
                                'wmv'   =>      array('video/wmv', 'video/x-ms-wmv', 'flv-application/octet-stream', 'application/octet-stream'),
                                'flv'   =>      array('video/flv', 'video/x-flv', 'flv-application/octet-stream', 'application/octet-stream'),
                                'avi'   =>      'video/x-msvideo'

My controller

Code:
public function upload_videos(){

  $config['upload_path'] = './uploads/videos';
  $config['allowed_types'] = 'avi|flv|wmv|mpeg|mp3|mp4';
  $config['max_size'] = 0;
  $config['max_width']  = 0;
  $config['max_height']  = 0;
  
  
    $this->load->library('upload', $config);
    $this->upload->initialize($config);

if ( ! $this->upload->do_upload()){
    $error = array('error' => $this->upload->display_errors());
    $this->load->view('media/videos_view', $error);
}else{
    $this->session->set_flashdata('success', '<p  red; font-weight:bold; font-size:20px;">Upload successed!<p>');
    redirect('media_ctrl/videos_view');
}
    
}
}
And I changed upload_max_filesize.


When i submited i have error


Code:
You did not select a file to upload.
Please help me what is wrong with it Sad
#2

[eluser]Massaki[/eluser]
Does your upload folder have writing permition?
#3

[eluser]CroNiX[/eluser]
Did you tell the upload class what field name it was so it knows where to look?
Code:
if ( ! $this->upload->do_upload('uploadFile')){
Since you aren't using the default 'userfile', you have to tell CI what field it is.
#4

[eluser]rad11[/eluser]
I named, a field call userfile

that look my form

Code:
&lt;?php
echo form_open_multipart('media_ctrl/upload_videos');
echo form_upload('userfile');
echo '<br />';
echo '<br />';
echo form_submit('upload', 'Upload');
echo form_close();
?&gt;
#5

[eluser]rad11[/eluser]
Ok I changed post_max_size = 30 and it is work. Smile




Theme © iAndrew 2016 - Forum software by © MyBB