diff --git a/wled00/wled_server.cpp b/wled00/wled_server.cpp index 626c2708..9775da24 100644 --- a/wled00/wled_server.cpp +++ b/wled00/wled_server.cpp @@ -37,10 +37,15 @@ void handleUpload(AsyncWebServerRequest *request, const String& filename, size_t return; } if (!index) { - request->_tempFile = WLED_FS.open(filename, "w"); + String finalname = filename; + if (finalname.charAt(0) != '/') { + finalname = "/" + finalname; // prepend slash if missing + } + + request->_tempFile = WLED_FS.open(finalname, "w"); DEBUG_PRINT("Uploading "); - DEBUG_PRINTLN(filename); - if (filename == F("/presets.json")) presetsModifiedTime = toki.second(); + DEBUG_PRINTLN(finalname); + if (finalname == "/presets.json") presetsModifiedTime = toki.second(); } if (len) { request->_tempFile.write(data,len);