Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

yiddishekop's avatar

File uploads failing on the server

Hi!

I am stuck with this weird issue:

Locally file uploads are working perfectly, but on the production server I get this error (from the logs) when uploading files:

production.ERROR: stream_copy_to_stream(): read of 8192 bytes failed with errno=21 Is a directory {"userId":28,"exception":"[object] (ErrorException(code: 0): stream_copy_to_stream(): read of 8192 bytes failed with errno=21 Is a directory at /var/www/jkaraoke-app/vendor/league/flysystem/src/Adapter/Local.php:159)

Info: Ubuntu, PHP 7.4, Laravel 7

Thanks everyone!

0 likes
4 replies
Braunson's avatar

Looks like your trying to read a directory? (Notice in the error Is a directory).

1 like
yiddishekop's avatar

If so it should have failed locally... 🤷‍♂️

yiddishekop's avatar

Interesting: the files show up in the destination folder, but they are empty.

Snapey's avatar

Could it be that you cannot read from the tmp folder? I've seen some weird issues with people that have the tmp path locked down.

I assume during the upload, you are moving the file from php's temp folder to the final destination.

Please or to participate in this conversation.