i want to upload video to me web video size 3G
but got error :
Request Entity Too Large
The requested resource does not allow request data with POST requests, or the amount of data provided in the request exceeds the capacity limit.
Apache/2.4.54 (Win64) OpenSSL/1.1.1p PHP/8.1.12 Server at 127.0.0.1 Port 80
419
Page Expired
my code
if($request->has('videos_path')){
$request->validate([
'videos_path'=>'required|file|max:380928|mimetypes:video/mp4',
]);
$extension = strtolower($request->videos_path->extension());
$filename = time() . rand(100, 999) . '.' . $extension;
$request->videos_path->getClientOriginalName = $filename;
$request->videos_path->move('assets/admin/uploads/movies/videos', $filename);
$data['videos_path']= 'assets/admin/uploads/movies/videos/'. $filename;
}
and in php.ini :
max_input_time=1080
post_max_size=4096M
upload_max_filesize= 4096M
2
Answers
When you want to upload a large file, you need to adjust both your Apache server settings and your PHP configuration. So you need to add
LimitRequestBody 0
to your.htaccess
file.Source: https://www.cyberciti.biz/faq/apache-limiting-upload-size/
I would advice no to upload large files as normal form field. Upload them as subsequent chunks.
Chunked upload is the process of breaking a file into smaller pieces, upload 'as is' and glue pieces into original file on the server side.
You can check this link for more detail.