-->
Page 4 of 5

Re: Stream binary data to webclient without file object

PostPosted: Tue Oct 25, 2016 4:47 pm
by danbicks
Hi Martin,

Thanks for the code example, does your version simply display the spiffs file contents in a web browser?

I am looking for the option that starts downloading the file itself to the local PC. Does the header need to change in order to acheive this?

Thanks

Dans

Re: Stream binary data to webclient without file object

PostPosted: Tue Oct 25, 2016 5:05 pm
by martinayotte
Yes, the file is simply display as "text/html" in the browser.
To get a save dialog from the browser, simply change content type with the following :
Code: Select allwebserver.send(200, "application/octet-stream", "");

Re: Stream binary data to webclient without file object

PostPosted: Tue Oct 25, 2016 5:10 pm
by danbicks
martinayotte wrote:Yes, the file is simply display as "text/html" in the browser.
To get a save dialog from the browser, simply change content type with the following :
Code: Select allwebserver.send(200, "application/octet-stream", "");


Martin,

Awesome as always, cheers buddy.

Dans

Re: Stream binary data to webclient without file object

PostPosted: Wed Oct 26, 2016 11:31 am
by ian
If I understand correctly you want a webserver which uses SPIFFS to hold content?
I do this. Not sure where I got the original idea/code but afaicr it was from the SD example
Minimal example here:
http://myiot.co.uk/min_spiffs.html

Ian