mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-07 16:01:30 +00:00
fflush()-ing uploaded file before calling MG_UPLOAD callback
This commit is contained in:
1 parent
6d4d53c247
commit
322ed3cc6f
1 file changed
+2
-1
+2
-1
@@ -4191,7 +4191,8 @@ int mg_upload(struct mg_connection *conn, const char *destination_dir) {
|
|||||||
if (!memcmp(&buf[i], "\r\n--", 4) &&
|
if (!memcmp(&buf[i], "\r\n--", 4) &&
|
||||||
!memcmp(&buf[i + 4], boundary, boundary_len)) {
|
!memcmp(&buf[i + 4], boundary, boundary_len)) {
|
||||||
// Found boundary, that's the end of file data.
|
// Found boundary, that's the end of file data.
|
||||||
(void) fwrite(buf, 1, i, fp);
|
fwrite(buf, 1, i, fp);
|
||||||
|
fflush(fp);
|
||||||
num_uploaded_files++;
|
num_uploaded_files++;
|
||||||
conn->request_info.ev_data = (void *) path;
|
conn->request_info.ev_data = (void *) path;
|
||||||
call_user(conn, MG_UPLOAD);
|
call_user(conn, MG_UPLOAD);
|
||||||
|
|||||||
Reference in new issue
Block a user