序列化 PNG 并发送到 Rest 客户端
Serialize PNG and Send to Rest Client
我正在向我的其他客户发送 png 格式的图像。
但是当我在客户端下载文件并尝试打开它时,我会得到错误。
我相信文件的 Headers 丢失了,但我怎样才能将它们添加到服务器响应中?
On the details of my picture i can see, that the size and so on is missing.
ifstream Stream;
Stream.open(FullFileName,std::ios::binary);
string Content, Line;
if (Stream)
{
while (getline(Stream,Line)){
Content += Line;
}
}
Stream.close();
Request::request->set_body(Content);
四处寻找后发现这边有一个postpost
以及我从中创建的 Sequenze。
ifstream *Stream = new ifstream(FullFileName, std::ios::in | std::ios::binary);
std::ostringstream *oss = new ostringstream();
*oss << Stream->rdbuf();
string *Content = new string(oss->str());
Stream->close();
Request::request->set_body(*Content);
我正在向我的其他客户发送 png 格式的图像。 但是当我在客户端下载文件并尝试打开它时,我会得到错误。 我相信文件的 Headers 丢失了,但我怎样才能将它们添加到服务器响应中?
On the details of my picture i can see, that the size and so on is missing.
ifstream Stream;
Stream.open(FullFileName,std::ios::binary);
string Content, Line;
if (Stream)
{
while (getline(Stream,Line)){
Content += Line;
}
}
Stream.close();
Request::request->set_body(Content);
四处寻找后发现这边有一个postpost
以及我从中创建的 Sequenze。
ifstream *Stream = new ifstream(FullFileName, std::ios::in | std::ios::binary);
std::ostringstream *oss = new ostringstream();
*oss << Stream->rdbuf();
string *Content = new string(oss->str());
Stream->close();
Request::request->set_body(*Content);