Welcome Guest, Not a member yet? Register   Sign In
How do you do Video upload
#1

(This post was last modified: 04-06-2022, 10:53 AM by luckmoshy.)

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?
Codeigniter First, Codeigniter Then You!!
yekrinaDigitals

Reply
#2

(This post was last modified: 04-06-2022, 11:54 AM by ignitedcms.)

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
Practical guide to IgnitedCMS - Book coming soon, www.ignitedcms.com
Reply
#3

(This post was last modified: 04-06-2022, 02:12 PM by luckmoshy.)

(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
Codeigniter First, Codeigniter Then You!!
yekrinaDigitals

Reply
#4

This may help you.

CODEBOXX - 3 Ways to Upload Large Files in PHP – Settings, Chunking, Resumable
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#5

(This post was last modified: 04-07-2022, 02:49 AM by luckmoshy.)

(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!
Codeigniter First, Codeigniter Then You!!
yekrinaDigitals

Reply




Theme © iAndrew 2016 - Forum software by © MyBB