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

ngozistephenTRIAL

a year ago

this is my codepublic 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);}

}

this is the error message i get 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

5 Replies

a year ago

Try adding these two files to your project -

https://gist.github.com/brody192/fcc1136b61c3de20609fa91ee384d47c

https://gist.github.com/brody192/ed12b50fd39e373a28d75f25b100a87d


ngozistephenTRIAL

a year ago

is not working



ngozistephenTRIAL

a year ago

that is the upload file size limit for Pro Plan


a year ago

There are no such restrictions tied to the plan type, I'm not sure where you got that idea from, this is purely a configuration issue.

Please attach your build logs otherwise I unfortunately will not be able to assist further.


413 Request Entity Too Large on Production but it uploads on Local server - Railway Help Station