mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2025-12-19 15:47:40 +03:00
Fix issue with uploading to subfolders
This commit is contained in:
parent
2aa1584582
commit
9c68d80781
@ -721,7 +721,6 @@ static const char* FILES_PAGE_FOOTER = R"rawliteral(
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
formData.append('path', currentPath);
|
||||
|
||||
const progressContainer = document.getElementById('progress-container');
|
||||
const progressFill = document.getElementById('progress-fill');
|
||||
@ -732,7 +731,9 @@ static const char* FILES_PAGE_FOOTER = R"rawliteral(
|
||||
uploadBtn.disabled = true;
|
||||
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open('POST', '/upload', true);
|
||||
// Include path as query parameter since multipart form data doesn't make
|
||||
// form fields available until after file upload completes
|
||||
xhr.open('POST', '/upload?path=' + encodeURIComponent(currentPath), true);
|
||||
|
||||
xhr.upload.onprogress = function(e) {
|
||||
if (e.lengthComputable) {
|
||||
@ -1241,7 +1242,9 @@ void CrossPointWebServer::handleUpload() {
|
||||
uploadSuccess = false;
|
||||
uploadError = "";
|
||||
|
||||
// Get upload path from form data (defaults to root if not specified)
|
||||
// Get upload path from query parameter (defaults to root if not specified)
|
||||
// Note: We use query parameter instead of form data because multipart form
|
||||
// fields aren't available until after file upload completes
|
||||
if (server->hasArg("path")) {
|
||||
uploadPath = server->arg("path");
|
||||
// Ensure path starts with /
|
||||
|
||||
@ -581,7 +581,7 @@ void WifiScreen::renderConnected() const {
|
||||
std::string webInfo = "Web: http://" + connectedIP + "/";
|
||||
renderer.drawCenteredText(UI_FONT_ID, top + 70, webInfo.c_str(), true, REGULAR);
|
||||
|
||||
renderer.drawCenteredText(SMALL_FONT_ID, pageHeight - 30, "Press any button to continue", true, REGULAR);
|
||||
renderer.drawCenteredText(SMALL_FONT_ID, pageHeight - 30, "Press any button to exit", true, REGULAR);
|
||||
}
|
||||
|
||||
void WifiScreen::renderSavePrompt() const {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user