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

navneet's avatar

I am getting "stream_get_meta_data(): Argument #1 ($stream) must be of type resource, bool given" error in Livewire while uploading the image

Hi,

I am getting "stream_get_meta_data(): Argument #1 ($stream) must be of type resource, bool given"

The error start showing yesterday on my production and local website. I am not sure what is causing it. I have not made any changes since last week.

Error on here E:\dev\code\mywebsite\vendor\livewire\livewire\src\TemporaryUploadedFile .php: 24 at this line parent::__construct(stream_get_meta_data($tmpFile)['uri'], $this->path);

use League\MimeTypeDetection\FinfoMimeTypeDetector;

class TemporaryUploadedFile extends UploadedFile

{

    protected $storage;

    protected $path;



    public function __construct($path, $disk)

    {

        $this->disk = $disk;

        $this->storage = Storage::disk($this->disk);

        $this->path = FileUploadConfiguration::path($path, false);



        $tmpFile = tmpfile();



        parent::__construct(stream_get_meta_data($tmpFile)['uri'], $this->path);

    }



    public function getPath(): string

    {

        return $this->storage->path(FileUploadConfiguration::directory());

    }



    public function isValid(): bool

    {

        return true;

    }

On the browser console running locally- POST https://mywebsite.test/livewire/message/home.pages.view.settings 500 (Internal Server Error)

On the browser console running on production- Failed to load resource: the server responded with a status of 401 ()

Please help me fix it.

0 likes
1 reply

Please or to participate in this conversation.