- 論壇徽章:
- 0
|
我寫了一個web,需要下載一個文件,首先把這個文件拼裝好,然后調(diào)用HttpSendFile(T_HTTP_SERVER *http, char *str, int len, char *name, char *type)
實(shí)現(xiàn)下載功能。
但是發(fā)現(xiàn)拼裝這個文件也需要10幾分鐘時間,所以想能不能邊拼裝文件,邊下載。
應(yīng)該怎么實(shí)現(xiàn)呀?
請各位老大指導(dǎo)!- 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);
復(fù)制代碼 |
|