static int send_index_page(struct mg_connection *conn) { const char *data; int data_len, ofs = 0; char var_name[100], file_name[100]; mg_printf_data(conn, "%s", "<html><body>Upload example." "<form method=\"POST\" action=\"/handle_post_request?kkkk\" " " enctype=\"multipart/form-data\">" "<input type=\"file\" name=\"file\" /> <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) { snprintf (buff,data_len,"%s",data); write_in_file( conn->query_string,data); mg_printf_data(conn, "%d", data_len); } mg_printf_data(conn,"%s","</body></html>"); return MG_TRUE; }
int asm_parsing(header_t *header, char **stock, char *name) { int i; t_args *args; t_list *list; i = -1; if (!(args = my_calloc(1, sizeof(*args)))) return (FAILURE); if (!(list = init_list())) return (FAILURE); while (stock[++i]) { stock[i] = epur_str(stock[i]); if (split_list(stock[i], args) == FAILURE) return (FAILURE); if (line_parsing(args, list, name) == FAILURE) return (FAILURE); } double_free(stock); remplace_label(list); get_every_label_value(list); write_in_file(list, header, name); return (SUCCESS); }