Nanoframework webserver download/upload file

455 views Asked by At

I've searched a lot but couldn't find an example.

I want to use nanorframework as a webserver where I can upload and download e.g. a JSON file from the browser which holds all my settings. Is this possible?

Otherwise if I want to change some settings I have to rebuild the whole solution and uploat it.

Thanks in advance

1

There are 1 answers

0
José Simões On

You can use the Storage libraries to store that Json file. The actual storage can support by flash (using SPIFFs), SD card or USB mass storage device. This depends on the hardware platform that you are using. Check the Storage samples in our samples repo here.

Downloading a file is pretty straightforward you just need to serve the respective HTTP request. Check the HTTP samples in our samples repo here.

Uploading a file it's a matter of handling the POST request and grabbing the data being sent by the client browser.