Browse Source

Fixed mg_upload() to work with multiple files.

Lawrence 9 năm trước cách đây
mục cha
commit
fed56ecb1c
1 tập tin đã thay đổi với 3 bổ sung1 xóa
  1. 3 1
      src/civetweb.c

+ 3 - 1
src/civetweb.c

@@ -8406,7 +8406,9 @@ int mg_upload(struct mg_connection *conn, const char *destination_dir)
 				memmove(buf, &buf[len - bl], (size_t)bl);
 				memmove(buf, &buf[len - bl], (size_t)bl);
 				len = bl;
 				len = bl;
 			}
 			}
-			n = mg_read(conn, buf + len, sizeof(buf) - ((size_t)(len)));
+			if (!eof) {
+				n = mg_read(conn, buf + len, sizeof(buf) - ((size_t)(len)));
+			}
 		} while (!eof && (n > 0));
 		} while (!eof && (n > 0));
 		fclose(fp);
 		fclose(fp);
 		if (eof) {
 		if (eof) {