下面的Arduino ESP32代码创建一个文件列表作为URL。我正在将WiFi客户端/服务器项目转换为使用AsyncWebServer库。需要帮助从URL提取文件名,并且能够检测文件名以下载到Async Web Server中。
2019-10-19 18:15:00,696 INFO [AsyncFSWAL-0] wal.AbstractFSWAL: Slow sync cost: 130 ms, current pipeline: [DatanodeInfoWithStorage[10.20.69.39:9866,DS-467702ba-44df-41c3-884f-cc24c595448f,DISK], DatanodeInfoWithStorage[10.20.80.28:9866,DS-f83fcab7-1551-4bf7-97b4-2a81ce2c09b2,DISK], DatanodeInfoWithStorage[10.20.80.29:9866,DS-34ded4dc-29f2-4a8b-8805-216e4b7a98c3,DISK]]
2019-10-19 18:15:00,696 INFO [AsyncFSWAL-0] wal.AbstractFSWAL: Slow sync cost: 129 ms, current pipeline: [DatanodeInfoWithStorage[10.20.69.39:9866,DS-467702ba-44df-41c3-884f-cc24c595448f,DISK], DatanodeInfoWithStorage[10.20.80.28:9866,DS-f83fcab7-1551-4bf7-97b4-2a81ce2c09b2,DISK], DatanodeInfoWithStorage[10.20.80.29:9866,DS-34ded4dc-29f2-4a8b-8805-216e4b7a98c3,DISK]]
2019-10-19 18:15:00,696 INFO [AsyncFSWAL-0] wal.AbstractFSWAL: Slow sync cost: 129 ms, current pipeline: [DatanodeInfoWithStorage[10.20.69.39:9866,DS-467702ba-44df-41c3-884f-cc24c595448f,DISK], DatanodeInfoWithStorage[10.20.80.28:9866,DS-f83fcab7-1551-4bf7-97b4-2a81ce2c09b2,DISK], DatanodeInfoWithStorage[10.20.80.29:9866,DS-34ded4dc-29f2-4a8b-8805-216e4b7a98c3,DISK]]
2019-10-19 18:15:00,696 INFO [AsyncFSWAL-0] wal.AbstractFSWAL: Slow sync cost: 129 ms, current pipeline: [DatanodeInfoWithStorage[10.20.69.39:9866,DS-467702ba-44df-41c3-884f-cc24c595448f,DISK], DatanodeInfoWithStorage[10.20.80.28:9866,DS-f83fcab7-1551-4bf7-97b4-2a81ce2c09b2,DISK], DatanodeInfoWithStorage[10.20.80.29:9866,DS-34ded4dc-29f2-4a8b-8805-216e4b7a98c3,DISK]]
尝试为Asyncwebserver编码:
String str;
if (!SPIFFS.begin(true))
{
Serial.println("An Error has occurred while mounting SPIFFS");
return;
}
File root = SPIFFS.open("/");
File file = root.openNextFile();
while (file)
{
if(strncmp(file.name(), "/LOG", 4) == 0)
{
str += "<a href=\"";
str += file.name();
str += "\">";
str += file.name();
str += "</a>";
str += " ";
str += file.size();
str += "<br>\r\n";
}
file = root.openNextFile();
}
client.print(str);
此代码产生:具有正确文件名的下载窗口;但是,内容只是“确定”。
我最初的尝试是尝试使用PHP。我还不具备PHP和Async Web Server的经验。
威廉
答案 0 :(得分:0)