413 Request Entity Too Large
I am uploading files to cloudinary with this code in laravel
````public function upload(Request $request)
{
$folder = 'product_photo';
if ($request->hasFile('photo')) {
$file = $request->file('photo');
request()->validate([
'photo' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg|max:6048',
]);
$cloudinaryResponse = Cloudinary::upload($file->getRealPath(), [
'folder' => $folder,
]);
$secureUrl = $cloudinaryResponse->getSecurePath();
return response()->json(['secure_url' => $secureUrl], 200);
} else {
return response()->json(['error' => 'No file uploaded'], 400);
}
}
the problem is that it works on local but on production it shows this error message
<html><head>
<title>413 Request Entity Too Large</title>
</head><body>
<center>
<h1>413 Request Entity Too Large</h1>
</center>
<hr>
<center>nginx/1.24.0</center>
</body></html>
my laravel application is hosted on railway. Please how can i solve this problem
Answers
-
Hi,
If you're trying to send more than 100 MB to Cloudinary's API in a single HTTP request, you need to use a chunked upload, by using the "upload_large" method in one of our SDKs, or implementing a chunking mechanism in your own code if you're uploading manually:If that doesn't explain what you're seeing, please open a ticket with our support team with details of the HTTP request that's being made by your application which receives that error from Cloudinary's servers
Regards,
Stephen0