Kaynağa Gözat

Merge pull request #203 from LawrenceChan/master

Fixed mg_upload() to work with multiple files.
bel2125 9 yıl önce
ebeveyn
işleme
72aec8838c
1 değiştirilmiş dosya ile 3 ekleme ve 1 silme
  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) {