mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-19 19:40:56 +00:00
Fix file upload iteration
This commit is contained in:
1 parent
d033497714
commit
824e4dc0e4
1 file changed
+6
-5
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
static int send_index_page(struct mg_connection *conn) {
|
static int send_index_page(struct mg_connection *conn) {
|
||||||
const char *data;
|
const char *data;
|
||||||
int data_len, ofs = 0;
|
int data_len, n1, n2;
|
||||||
char var_name[100], file_name[100];
|
char var_name[100], file_name[100];
|
||||||
|
|
||||||
mg_printf_data(conn, "%s",
|
mg_printf_data(conn, "%s",
|
||||||
@@ -19,12 +19,13 @@ static int send_index_page(struct mg_connection *conn) {
|
|||||||
"<input type=\"submit\" value=\"Upload\" />"
|
"<input type=\"submit\" value=\"Upload\" />"
|
||||||
"</form>");
|
"</form>");
|
||||||
|
|
||||||
while ((ofs = mg_parse_multipart(conn->content + ofs, conn->content_len - ofs,
|
n1 = n2 = 0;
|
||||||
var_name, sizeof(var_name),
|
while ((n2 = mg_parse_multipart(conn->content + n1, conn->content_len - n1,
|
||||||
file_name, sizeof(file_name),
|
var_name, sizeof(var_name), file_name,
|
||||||
&data, &data_len)) > 0) {
|
sizeof(file_name), &data, &data_len)) > 0) {
|
||||||
mg_printf_data(conn, "var: %s, file_name: %s, size: %d bytes<br>",
|
mg_printf_data(conn, "var: %s, file_name: %s, size: %d bytes<br>",
|
||||||
var_name, file_name, data_len);
|
var_name, file_name, data_len);
|
||||||
|
n1 += n2;
|
||||||
}
|
}
|
||||||
|
|
||||||
mg_printf_data(conn, "%s", "</body></html>");
|
mg_printf_data(conn, "%s", "</body></html>");
|
||||||
|
|||||||
Reference in new issue
Block a user