Browse Source

Merge pull request #203 from LawrenceChan/master

Fixed mg_upload() to work with multiple files.
bel2125 9 years ago
parent
commit
72aec8838c
1 changed files with 3 additions and 1 deletions
  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);
 				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));
 		fclose(fp);
 		if (eof) {