From a328aa4af999f489d431874d33c74df8a75574c9 Mon Sep 17 00:00:00 2001 From: Xuan Sang LE Date: Mon, 1 Oct 2018 18:42:01 +0200 Subject: [PATCH] fix upload file problem --- http_server.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/http_server.c b/http_server.c index ea34a3d..928b46e 100644 --- a/http_server.c +++ b/http_server.c @@ -834,8 +834,10 @@ void decode_multi_part_request(void* client,const char* ctype, dictionary dic) totalsize += len; } //remove \r\n at the end - fseek(fp,-2, SEEK_CUR); + fseek(fp, 0, SEEK_SET); + //fseek(fp,-2, SEEK_CUR); totalsize -= 2; + ftruncate(fileno(fp),totalsize); fclose(fp); line = strdup(buf);