Media upload filesize(): stat failed for uploads error Laravel – TwitterOauth

  laravel, php, twitter-oauth

I am using Abraham’s https://twitteroauth.com/ package for sending twitter messages from Laravel App.

Also I scheduled messages with Laravel task scheduling.
I also need to send media twitter message with this package. It works normally. But it does not work with laravel task schedule console command.

It throws this error:

filesize(): stat failed for uploads/screenshots_1620116807.png

at vendor/abraham/twitteroauth/src/TwitterOAuth.php:417
  413▕             'shared',
  414▕         ];
  415▕         $base = [
  416▕             'command' => 'INIT',
➜ 417▕             'total_bytes' => filesize($parameters['media']),
  418▕         ];
  419▕         $allowed_parameters = array_intersect_key(
  420▕             $parameters,
  421▕             array_flip($allowed_keys),

    +3 vendor frames
4   app/Services/TwitterService.php:219
    AbrahamTwitterOAuthTwitterOAuth::upload() 

How can I solve this error for console task command?

Thanks

Source: Ask PHP

LEAVE A COMMENT