mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-31 13:00:49 +00:00
Remove old docs, rename docs_new to docs
It would be probably good idea to also remove tools/docgen.py and asciidoc.mk, but asciidoc.mk is still mentioned under `cloud/doc`, which may contain some useful info which we'll need at least to review before removing. PUBLISHED_FROM=faf454d4c52a2f07ea8ac084cf0bd11a0c9c9b3b
This commit is contained in:
1 parent
f443c64341
commit
23122b327c
182 files changed
+3592
-263
No files matched your search
@@ -0,0 +1,39 @@
|
||||
---
|
||||
title: "mg_file_upload_handler()"
|
||||
decl_name: "mg_file_upload_handler"
|
||||
symbol_kind: "func"
|
||||
signature: |
|
||||
void mg_file_upload_handler(struct mg_connection *nc, int ev, void *ev_data,
|
||||
mg_fu_fname_fn local_name_fn);
|
||||
---
|
||||
|
||||
File upload handler.
|
||||
This handler can be used to implement file uploads with minimum code.
|
||||
This handler will process MG_EV_HTTP_PART_* events and store file data into
|
||||
a local file.
|
||||
`local_name_fn` will be invoked with whatever name was provided by the client
|
||||
and will expect the name of the local file to open. Return value of NULL will
|
||||
abort file upload (client will get a "403 Forbidden" response). If non-null,
|
||||
the returned string must be heap-allocated and will be freed by the caller.
|
||||
Exception: it is ok to return the same string verbatim.
|
||||
|
||||
Example:
|
||||
|
||||
```c
|
||||
struct mg_str upload_fname(struct mg_connection *nc, struct mg_str fname) {
|
||||
// Just return the same filename. Do not actually do this except in test!
|
||||
// fname is user-controlled and needs to be sanitized.
|
||||
return fname;
|
||||
}
|
||||
void ev_handler(struct mg_connection *nc, int ev, void *ev_data) {
|
||||
switch (ev) {
|
||||
...
|
||||
case MG_EV_HTTP_PART_BEGIN:
|
||||
case MG_EV_HTTP_PART_DATA:
|
||||
case MG_EV_HTTP_PART_END:
|
||||
mg_file_upload_handler(nc, ev, ev_data, upload_fname);
|
||||
break;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Reference in new issue
Block a user