-->
Page 1 of 1

ESP8266web + SD card - bad download filename

PostPosted: Thu Nov 30, 2017 2:13 am
by George Lendel
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:
Code: Select allopen 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.

Re: ESP8266web + SD card - bad download filename

PostPosted: Fri Dec 01, 2017 12:45 pm
by Barnabybear
Hi, just speculating but you send the file name to the ESP / SD card but it only returns the file not the file name. It looks like as you don’t specify a file name and it is stored under a generic name.