Sending file from ESP, download in browser.
Posted: Sun May 13, 2018 5:16 pm
I'm having trouble sending a file from the ESP acting as a server, to a browser requesting the resource.
I'm using the SSL api and reading a file from an SD card and sending it to a client on request. Had good success sending HTTP header specifying html content which is displayed in browser. However, when specifying a file to be downloaded as a file by the browser (Content-Type: application/octet-stream) the browser begins downloading the file, then stops at 68.0KB(?). If the file is smaller, it just hangs at "starting download...". This is with chrome but I have also tried Mozilla Firefox with the same result.
The file is sent simply by reading part of sd card file into buffer, sending it, then repeating until whole file is sent. I have a feeling the problem originates from here. I only feel this way as it seems too simple a process aha.
I've done a lot of searching about as I am unsure of what could be causing this issue. I feel like it is probably an issue caused by how I have coded the file exchange, rather than anything esp specific. I'm hoping somebody here knows this area well and might know??
I'll be continuing working on this and a solution but if anybody can help that would be great. If you would like to see the code or know any other important information just let me know!
I'm using the SSL api and reading a file from an SD card and sending it to a client on request. Had good success sending HTTP header specifying html content which is displayed in browser. However, when specifying a file to be downloaded as a file by the browser (Content-Type: application/octet-stream) the browser begins downloading the file, then stops at 68.0KB(?). If the file is smaller, it just hangs at "starting download...". This is with chrome but I have also tried Mozilla Firefox with the same result.
The file is sent simply by reading part of sd card file into buffer, sending it, then repeating until whole file is sent. I have a feeling the problem originates from here. I only feel this way as it seems too simple a process aha.
I've done a lot of searching about as I am unsure of what could be causing this issue. I feel like it is probably an issue caused by how I have coded the file exchange, rather than anything esp specific. I'm hoping somebody here knows this area well and might know??
I'll be continuing working on this and a solution but if anybody can help that would be great. If you would like to see the code or know any other important information just let me know!