413 Request Entity Too Large on Production but it uploads on Local server

NgoziStephen Member Posts: 2

this is my code
public function upload(Request $request)
$folder = 'product_photo';

if ($request->hasFile('photo')) {
$file = $request->file('photo');
'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);

this is the error message i get

the problem is that it works on local but on production it shows this error message

<title>413 Request Entity Too Large</title>
<h1>413 Request Entity Too Large</h1>

my laravel application is hosted on railway.

Please how can i solve this problem


  • Tom
    Tom Member, Cloudinary Staff Posts: 78

    HI @NgoziStephen ,

    Thanks for reaching out.

    413 entity large error is usually received when you try to upload an asset that is larger than 100MB but you're still using the standard upload method from our SDK.

    You would need to instead use which the SDK does support via the function upload_large, more details here: https://cloudinary.com/documentation/upload_images#chunked_asset_upload

    Please let me know how you get on.

    Kind Regards,