HTTPCli_sendRequestBody,这个函数里定义的长度类型为int,文档也没有详细描述,但是我试了下,这个函数最多只能传3000多个字节,而我的图片有30多K,
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
HTTPCli_sendRequestBody,这个函数里定义的长度类型为int,文档也没有详细描述,但是我试了下,这个函数最多只能传3000多个字节,而我的图片有30多K,
可能是因为buffer不够。发送图片的话,可以把图片读进buffer里面然后用HTTPCli_sendRequestBody()发送。
文件读取的例程请参考 file_operation example :
imagelen = sl_FsRead(FileHdl, 0 , buf, sizeof(buf));
HTTPCli_sendRequestBody(httpClient, buf, imagelen);
如果内存限制导致buffer不够,可以多次调用HTTPCli_sendRequestBody()
offset = 0;
bytesRead = sl_FsRead(FileHdl, offset , buf, 1024);
while(bytesRead>0)
{
HTTPCli_sendRequestBody(httpClient, buf, bytesRead );
bytesRead = sl_FsRead(FileHdl, (offset+bytesread) , buf, 1024);
}