【发布时间】:2016-02-05 01:26:56
【问题描述】:
当我尝试使用 Twitter API 发布图片或视频时,我收到错误消息
{"request":"/i/media/upload.json","error":"段不加起来 提供总文件大小。"}
Google 没有关于此错误的任何信息。 Twitter 文档也无济于事。怎么了?
我在做什么:
1. INIT uploading file
> $this->SetUrl('upload.twitter.com/i/media/upload.json?command=INIT&media_type=image%2Fpng&total_bytes='
> . $filesize)
> ->SendRequest('post');
2. APPEND chunks
> $reply = ['media' => $chunk];
> $this->SetQuery($reply);
> $this->SetUrl('upload.twitter.com/i/media/upload.json?command=APPEND&media_id='.$mediaId.'&segment_index='.$segment_id)->SendRequest('post');
3. When I FINALIZE, I get the error
> $this->SetUrl('upload.twitter.com/i/media/upload.json?command=FINALIZE&media_id='
> . $mediaId)->SendRequest('post');
【问题讨论】:
-
更正语法;改进的格式。实际的问题演示很好。
-
您解决了吗?我遇到了同样的问题。
-
丽莎,我的问题是我收到了错误的数据块。发送完成请求时,我生成了一个错误,即块的数量不等于总文件大小。一旦计算机将 - 将在此处发布代码
标签: php twitter file-upload