Add fs arg to mg_file* and mg_http_upload API

This commit is contained in:
Sergey Lyubka committed 2022-01-18 17:11:02 +00:00
1 parent 09df542db8
commit 56a7438114
20 files changed
+447 -367

No files matched your search

+1 -1
View File
@@ -147,7 +147,7 @@ static void broadcast_mjpeg_frame(struct mg_mgr *mgr) {
static size_t i;
const char *path = files[i++ % nfiles];
size_t size = 0;
char *data = mg_file_read(path, &size); // Read next file
char *data = mg_file_read(&mg_fs_posix, path, &size); // Read next file
struct mg_connection *c;
for (c = mgr->conns; c != NULL; c = c->next) {
if (c->label[0] != 'S') continue; // Skip non-stream connections
+1 -1
View File
@@ -40,7 +40,7 @@ void app_main(void) {
.base_path = FS_ROOT, .max_files = 20, .format_if_mount_failed = true};
int res = esp_vfs_spiffs_register(&conf);
LOG(res == ESP_OK ? LL_INFO : LL_ERROR, ("FS %s, %d", conf.base_path, res));
mg_file_printf(FS_ROOT "/hello.txt", "%s", "hello from ESP");
mg_file_printf(&mg_fs_posix, FS_ROOT "/hello.txt", "%s", "hello from ESP");
// Setup wifi. This function is implemented in wifi.c
// It blocks until connected to the configured WiFi network
+1 -1
View File
@@ -33,7 +33,7 @@ static void broadcast_mjpeg_frame(struct mg_mgr *mgr) {
static size_t i;
const char *path = files[i++ % nfiles];
size_t size = 0;
char *data = mg_file_read(path, &size); // Read next file
char *data = mg_file_read(&mg_fs_posix, path, &size); // Read next file
struct mg_connection *c;
for (c = mgr->conns; c != NULL; c = c->next) {
if (c->label[0] != 'S') continue; // Skip non-stream connections