Skip to content

Commit

Permalink
SPIFFSEditor: Add an optional parameter path for POST
Browse files Browse the repository at this point in the history
  • Loading branch information
steff393 authored Dec 30, 2024
1 parent 3a91c88 commit 0856b86
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/SPIFFSEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,10 @@ void SPIFFSEditor::handleRequest(AsyncWebServerRequest *request){
} else
request->send(404);
} else if(request->method() == HTTP_POST){
if(request->hasParam("data", true, true) && _fs.exists(request->getParam("data", true, true)->value()))
// /*SF-begin*/ Add an optional parameter path to control the filename (for example add the /)
if (request->hasParam("data", true, true) && request->hasParam("path", true, true) && _fs.exists(request->getParam("path", true, true)->value())) {
request->send(200, "", "UPLOADED: "+request->getParam("path", true, true)->value());
} else /*SF-end*/ if(request->hasParam("data", true, true) && _fs.exists(request->getParam("data", true, true)->value()))
request->send(200, "", "UPLOADED: "+request->getParam("data", true, true)->value());
else
request->send(500);
Expand Down

0 comments on commit 0856b86

Please sign in to comment.