다운로드 파일명 유지

This commit is contained in:
2025-10-06 17:43:00 +00:00
parent 4a4c3ce710
commit 16e0ba1c85

View File

@@ -756,6 +756,15 @@ void setup() {
if (SD.exists(filename)) {
File file = SD.open(filename, FILE_READ);
if (file) {
// 파일명만 추출 (경로 제거)
String displayName = server.arg("file");
// Content-Disposition 헤더 추가 (원본 파일명 지정)
server.sendHeader("Content-Disposition",
"attachment; filename=\"" + displayName + "\"");
server.sendHeader("Content-Type", "application/octet-stream");
// 파일 전송
server.streamFile(file, "application/octet-stream");
file.close();
} else {
@@ -768,7 +777,6 @@ void setup() {
server.send(400, "text/plain", "Bad request");
}
});
server.begin();
canQueue = xQueueCreate(CAN_QUEUE_SIZE, sizeof(CANMessage));