Upload media video

php

#1

Hi, Team

I am using the twitter PHP Rest API to upload a media file. it work for the two step init and append ,on while finalize i am getting {“errors”:[{“message”:“Internal error”,“code”:131}]}

how can i fix this my chank logic,

while (!feof($fp)) {
    $chunk = fread($fp, 1048576); // 1MB per chunk for this sample
   
   	$postfields1 =  array(
	'command' => 'APPEND',
    'media_id'  => $res1->media_id,
    'segment_index' => $segment_id,// Don't give up..
	'media'    => $chunk
  );
  
 echo $resap = $twitter->buildOauth($url, $requestMethod)
             ->setPostfields($postfields1)
             ->performRequest();
    $segment_id++;
}