Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
mongoose
Commits
824e4dc0
Commit
824e4dc0
authored
Jun 19, 2015
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix file upload iteration
parent
d0334977
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
file_upload.c
examples/file_upload/file_upload.c
+6
-5
No files found.
examples/file_upload/file_upload.c
View file @
824e4dc0
...
...
@@ -7,7 +7,7 @@
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"
,
...
...
@@ -19,12 +19,13 @@ static int send_index_page(struct mg_connection *conn) {
"<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>"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment