CodeIgniter Forums
How do you do Video upload - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: How do you do Video upload (/showthread.php?tid=81669)



How do you do Video upload - luckmoshy - 04-06-2022

Hi all, I am facing errors in uploading the Video

PHP Code:
private $VideoUploder;
 
 public function 
__construct(){     
         
$this->db= \Config\Database::connect();
         
$this->VideoUploder $this->db->table('videotable');
 }

 
  public function storeVideo()
  {  
    
if ($this->request->getMethod() === 'post' ){        
        $validated 
$this->validate([
            'video' => [
                'uploaded[video]',
              'mime_in[video,video/mp4]',
            ],
        ]);
        if ($validated) {
 
            $VideoFile $this->request->getFile('video');
 
 
  
 
if($VideoFile->isValid() && ! $VideoFile->hasMoved())
 {
 
$saveVideoFile $VideoFile->getClientName();
 
$VideoFile->store('Videofolder/',$saveVideoFile);   
   
}
          $data = [ 
                     /*Model var*/ 'VideoName' =>  $VideoFiles->getClientName(),
 
/*Model var*/'videoFile'=> $saveVideoFile
          
];
 
  if ($this->VideoUploder->insert($data) == true)
 
  {
 
    return redirect()->to('videoview')->with('success',lang('Alert.success'));             
   
}
        }else
 
    return redirect()->to('videoview')->with('validation',$this->validator);/*does not show  errors or file uploaded in a folder*/
 
  
 
  

I get no errors or files uploaded in a folder but if this way changed to image works fine why?


RE: How do you do Video upload - ignitedcms - 04-06-2022

Not sure, didn't really look at the code, but my initial thoughts would be it is a mime type issue or the video file is too big to send over the network. Normally PHP has a 10mb upload limit which you can change in the ini file (but it isn't reliable for huge files), and the only way to reliably overcome this is using a chunked uploader, such as plu-upload, actually resumable.js is a better option (historically due to web browsers issues this used to be a problem and had a flash fallback - no longer applicable obviously, but it is something I'm planning to integrate into my own engine, I'm not entirely sure if this has been implemented in CI4 RESTful folder, so it might not be this.

https://github.com/pionl/laravel-chunk-upload


RE: How do you do Video upload - luckmoshy - 04-06-2022

(04-06-2022, 11:19 AM)ignitedcms Wrote: Not sure, didn't really look at the code, but my initial thoughts would be it is a mime type issue or the video file is too big to send over the network. Normally PHP has a 10mb upload limit which you can change in the ini file (but it isn't reliable for huge files), and the only way to reliably overcome this is using a chunked uploader, such as plu-upload, actually resumable.js is a better option (historically due to web browsers issues this used to be a problem and had a flash fallback - no longer applicable obviously, but it is something I'm planning to integrate into my own engine, I'm not entirely sure if this has been implemented in CI4 RESTful folder, so it might not be this.

https://github.com/pionl/laravel-chunk-upload

Thank you for your reply @ignitercms of cause I want to limit only to a maximum of 4MB of videos but does not work at all check-in log file has no error no errors just silent also I inspected in mime type in there is mp4 video type support

some thing like this worked a lot to me

https://github.com/ankitpokhrel/tus-php


RE: How do you do Video upload - InsiteFX - 04-07-2022

This may help you.

CODEBOXX - 3 Ways to Upload Large Files in PHP – Settings, Chunking, Resumable


RE: How do you do Video upload - luckmoshy - 04-07-2022

(04-07-2022, 01:19 AM)InsiteFX Wrote: This may help you.

CODEBOXX - 3 Ways to Upload Large Files in PHP – Settings, Chunking, Resumable


perfect @InsetFx worked but I want to recommend CI to assemble like this is sometimes needed!