Commit 955d4a31 authored by Бобби's avatar Бобби Committed by Cesanta Bot

Fix file upload on windows

CL: Fix https://github.com/cesanta/mongoose/issues/962 - file upload on windows

PUBLISHED_FROM=85688eee147a1df468cca92f4ac61526ce9c02bf
parent b84981ad
...@@ -8328,7 +8328,7 @@ void mg_file_upload_handler(struct mg_connection *nc, int ev, void *ev_data, ...@@ -8328,7 +8328,7 @@ void mg_file_upload_handler(struct mg_connection *nc, int ev, void *ev_data,
if (lfn.p != mp->file_name) MG_FREE((char *) lfn.p); if (lfn.p != mp->file_name) MG_FREE((char *) lfn.p);
LOG(LL_DEBUG, LOG(LL_DEBUG,
("%p Receiving file %s -> %s", nc, mp->file_name, fus->lfn)); ("%p Receiving file %s -> %s", nc, mp->file_name, fus->lfn));
fus->fp = mg_fopen(fus->lfn, "w"); fus->fp = mg_fopen(fus->lfn, "wb");
if (fus->fp == NULL) { if (fus->fp == NULL) {
mg_printf(nc, mg_printf(nc,
"HTTP/1.1 500 Internal Server Error\r\n" "HTTP/1.1 500 Internal Server Error\r\n"
......
...@@ -2737,7 +2737,7 @@ void mg_file_upload_handler(struct mg_connection *nc, int ev, void *ev_data, ...@@ -2737,7 +2737,7 @@ void mg_file_upload_handler(struct mg_connection *nc, int ev, void *ev_data,
if (lfn.p != mp->file_name) MG_FREE((char *) lfn.p); if (lfn.p != mp->file_name) MG_FREE((char *) lfn.p);
LOG(LL_DEBUG, LOG(LL_DEBUG,
("%p Receiving file %s -> %s", nc, mp->file_name, fus->lfn)); ("%p Receiving file %s -> %s", nc, mp->file_name, fus->lfn));
fus->fp = mg_fopen(fus->lfn, "w"); fus->fp = mg_fopen(fus->lfn, "wb");
if (fus->fp == NULL) { if (fus->fp == NULL) {
mg_printf(nc, mg_printf(nc,
"HTTP/1.1 500 Internal Server Error\r\n" "HTTP/1.1 500 Internal Server Error\r\n"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment