File Server shows no files inside the directories

esp-dev
Posts: 14
Joined: Mon Jul 04, 2022 5:44 pm

File Server shows no files inside the directories

Postby esp-dev » Thu Jul 21, 2022 12:27 pm

Hello,

While I'm exploring the file sever example in the SDK: https://github.com/espressif/esp-idf/tr ... le_serving I was successful in connecting and visualising the files in the base_path.

Code: Select all

base_path = "/sdcard"
However, when I try to access the files inside the directory, it say file not exists, but on the ESP_LOG it says,

Code: Select all

I (5606) example: File server started
I (16456) file_server: Found directory : PREDICT (0 bytes)
E (34206) file_server: Failed to stat dir : /sdcard/PREDICT/
W (34206) httpd_txrx: httpd_resp_send_err: 404 Not Found - Directory does not exist
W (34216) httpd_uri: httpd_uri: uri handler execution failed
My directory looks something like this,

Code: Select all

.
└── predict
    ├──ZA_R01_1.jpg
    └── ZA_R01_2.jpg

1 directory, 2 files
What's missing in this? Do I need some config to access files inside the directory?

esp-dev
Posts: 14
Joined: Mon Jul 04, 2022 5:44 pm

Re: File Server shows no files inside the directories

Postby esp-dev » Thu Jul 21, 2022 4:48 pm

Does it need some more information to look at it? Let me know I can provide.

esp-dev
Posts: 14
Joined: Mon Jul 04, 2022 5:44 pm

Re: File Server shows no files inside the directories

Postby esp-dev » Mon Jul 25, 2022 1:00 pm

Update: I've played around the URI paths and came to know that, I'm able to access the files with it's absolute URLs, however, when it lists the directory, it is not listing the files inside it.

Since I'm new to web, I'm pretty much feeling confused. Some body worked with these kind of stuff?

Let me know, this will be helpful.

abansal22
Posts: 105
Joined: Wed Apr 22, 2020 8:24 am

Re: File Server shows no files inside the directories

Postby abansal22 » Mon Jul 25, 2022 1:18 pm

esp-dev wrote:
Thu Jul 21, 2022 12:27 pm
Hello,

While I'm exploring the file sever example in the SDK: https://github.com/espressif/esp-idf/tr ... le_serving I was successful in connecting and visualising the files in the base_path.

Code: Select all

base_path = "/sdcard"
However, when I try to access the files inside the directory, it say file not exists, but on the ESP_LOG it says,

Code: Select all

I (5606) example: File server started
I (16456) file_server: Found directory : PREDICT (0 bytes)
E (34206) file_server: Failed to stat dir : /sdcard/PREDICT/
W (34206) httpd_txrx: httpd_resp_send_err: 404 Not Found - Directory does not exist
W (34216) httpd_uri: httpd_uri: uri handler execution failed
My directory looks something like this,

Code: Select all

.
└── predict
    ├──ZA_R01_1.jpg
    └── ZA_R01_2.jpg

1 directory, 2 files
What's missing in this? Do I need some config to access files inside the directory?
Please note the following lines:
"Currently, SPIFFS does not support directories, it produces a flat structure. If SPIFFS is mounted under /spiffs, then creating a file with the path /spiffs/tmp/myfile.txt will create a file called /tmp/myfile.txt in SPIFFS, instead of myfile.txt in the directory /spiffs/tmp"

There are no directory in the spiffs, everything is file. Thats why the URI path opening the files. But you can make the program using regrex, list the files with name pattern "/PREDICT/*" and send it to front end. for more info click on this

https://docs.espressif.com/projects/esp ... piffs.html

Thanks
Ankit Bansal

esp-dev
Posts: 14
Joined: Mon Jul 04, 2022 5:44 pm

Re: File Server shows no files inside the directories

Postby esp-dev » Mon Jul 25, 2022 2:38 pm

Ankit,

Thanks man. This clarifies things.

Who is online

Users browsing this forum: DrMickeyLauer, Google [Bot] and 97 guests