How to fix fails in video uploads in cPanel in Laravel in best way?

There can be multiple reasons for fails in video uploads. Video upload fails are often because of the large size, formats or codecs of the video file. That’s why we define validation rules for video uploads. There can be various reasons for failed video uploads. Most probably, these are the validation fails, but they don’t have any connection to cPanel. They are linked to video uploaded and validation rules defined ourselves. However, we can always double check the database credentials and validation rules in cPanel for video uploads. Here are some ways to fix fails in video uploads.

Double check database credentials

You can open cPanel and double check the database credentials in phpmyadmin. These should match the credentials you have entered in your Laravel application inside the database.php file.

This will avoid upload fails for other files and images also. Likewise, will work for video files and all posting to database.

Change cPanel file permissions

All files and directories (folders) of your cPanel account have permissions. These control who can read, write, and execute that file. Default permissions are assigned to files, on creation. Most users don’t need to change permissions, but when updates or installations are required. we require a file permissions change. File permissions can be viewed and changed through either the cPanel File Manager or most FTP program.

Incorrect file permissions can cause errors or, and won’t allow a user to update or upload files at the specific location. 777 permissions mean that your file is readable, writable, and executable by anyone who can access it. Your video upload location may not have a 777 file permission or one where a user can write or upload a video file. This may result in video upload fails on the cPanel.

Changing file permission for video upload directory can help solve your problem.

Edit the php.ini file

Sometime, video upload failed error can be caused by php.ini. since the file size is more than 2M, because its a video file. We should change the upload_max_filesize and post_max_size variables in the php.ini file. To do this.

You may go to C:\xampp\php directory and open php.ini with your editor. Then find the  upload_max_filesize and post_max_size, and change them 100M.
You can then restart Apache server and do the uploading process.

Video upload fails can be for multiple reasons. The above are fixes for the most expected cases. Hope these points helped you to fix fails in video uploads.