ESP8266web + SD card - bad download filename
Posted: Thu Nov 30, 2017 2:13 am
Hi all,
I have problem when downloading file from SD card via web server. The file downloads correctly, but it's named wrong when downloaded.
What I do is:
The file doesn't save as somefile.txt but saves as file1.dms. Is there a way to correct this? I need the file to be saved as somefile.txt, the same as it is on the SD card.
I have problem when downloading file from SD card via web server. The file downloads correctly, but it's named wrong when downloaded.
What I do is:
Code: Select all
open page in web browser with argument ?L=somefile.txt
if(webServer.arg("L")!=""){
String filename=webServer.arg("L");
String dataType = "application/octet-stream";
File dataFile=SD.open(filename);
webServer.streamFile(dataFile, dataType) ;
dataFile.close();
}
The file doesn't save as somefile.txt but saves as file1.dms. Is there a way to correct this? I need the file to be saved as somefile.txt, the same as it is on the SD card.