- 论坛徽章:
- 0
|
我写了一个web,需要下载一个文件,首先把这个文件拼装好,然后调用HttpSendFile(T_HTTP_SERVER *http, char *str, int len, char *name, char *type)
实现下载功能。
但是发现拼装这个文件也需要10几分钟时间,所以想能不能边拼装文件,边下载。
应该怎么实现呀?
请各位老大指导!- HttpSendFile(T_HTTP_SERVER *http, char *str, int len, char *name, char *type)
- {
- HttpSetContent(http, 0);
- HttpSetContent(http, "HTTP/1.1 200 OK\r\n");
- HttpSetContent(http, "Content-Disposition: attachment; filename=");
- HttpSetContent(http, name);
- HttpSetContent(http, "\r\n");
- HttpSetContent(http, "Content-Type: ");
- HttpSetContent(http, type);
- HttpSetContent(http, "\r\n");
- HttpSetContentLen(http, "Content-Length: ", len);
- HttpSetContent(http, "\r\n");
- HttpSendContent(http, str, len);
复制代码 |
|