Laravel 8.38 validation issue, max file size. RuntimeException: The file {public path} cannot be opened. in file Psr17Factory.php on line 46

Viewed 520

Created the file validation as (for test purpose it is 5kb)

'file': "max:5|mimes:jpg,png,jpeg,pdf,txt,doc,docx,mp4"

There is a weird issue, as it is displaying a valid error on uploading png

...may not be greater than 5 kilobytes.

but on uploading mp4 it is throwing following error

RuntimeException: The file {path-here}\public cannot be opened. in file 
{path-here}\vendor\nyholm\psr7\src\Factory\Psr17Factory.php on line 46 
2 Answers
  1. Open icons tray on right side of your windows.
  2. left click on wamp icon.
  3. click on PHP > PHP Settings > upload_max_filesize = (set the size to max 256 MB).

You can also edit it in php.ini file in C:\wamp64\bin\apache\apache2.4.37\bin\php.ini click here for image

I was having same error when sending file via postman to server with Laragon(not wamp/xampp) tried setting up my upload_max_file but couldn't find luck. In the end, Running Laragon with Run as Administrator did work.

Related