summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/mongoose/examples/file_upload/file_upload.c
diff options
context:
space:
mode:
author Cowering <cowering@users.noreply.github.com>2015-07-04 18:48:18 -0500
committer Cowering <cowering@users.noreply.github.com>2015-07-08 23:37:54 -0500
commit43ef9c65e05259f8566c99f7f3d410c0eef6fa25 (patch)
tree1f474f7e47fc27e1133da53da7ac345138c43f15 /3rdparty/mongoose/examples/file_upload/file_upload.c
parent6e855b9cf7c65f17ed087222c26497688fffe5e4 (diff)
newest mongoose.. PRETTY sure I didn't alter anything (NW)
Diffstat (limited to '3rdparty/mongoose/examples/file_upload/file_upload.c')
-rw-r--r--3rdparty/mongoose/examples/file_upload/file_upload.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/3rdparty/mongoose/examples/file_upload/file_upload.c b/3rdparty/mongoose/examples/file_upload/file_upload.c
index f0c6a1a4238..eedfc837c57 100644
--- a/3rdparty/mongoose/examples/file_upload/file_upload.c
+++ b/3rdparty/mongoose/examples/file_upload/file_upload.c
@@ -7,23 +7,25 @@
static int send_index_page(struct mg_connection *conn) {
const char *data;
- int data_len, ofs = 0;
+ int data_len, n1, n2;
char var_name[100], file_name[100];
mg_printf_data(conn, "%s",
"<html><body>Upload example."
"<form method=\"POST\" action=\"/handle_post_request\" "
" enctype=\"multipart/form-data\">"
- "<input type=\"file\" name=\"file\" /> <br/>"
+ "<input type=\"file\" name=\"file1\" /> <br/>"
+ "<input type=\"file\" name=\"file2\" /> <br/>"
"<input type=\"submit\" value=\"Upload\" />"
"</form>");
- while ((ofs = mg_parse_multipart(conn->content + ofs, conn->content_len - ofs,
- var_name, sizeof(var_name),
- file_name, sizeof(file_name),
- &data, &data_len)) > 0) {
+ n1 = n2 = 0;
+ while ((n2 = mg_parse_multipart(conn->content + n1, conn->content_len - n1,
+ var_name, sizeof(var_name), file_name,
+ sizeof(file_name), &data, &data_len)) > 0) {
mg_printf_data(conn, "var: %s, file_name: %s, size: %d bytes<br>",
var_name, file_name, data_len);
+ n1 += n2;
}
mg_printf_data(conn, "%s", "</body></html>");