![]() |
Forum Index : Microcontroller and PC projects : WebMite (Pico 2) - File download
Author | Message | ||||
Nimue![]() Guru ![]() Joined: 06/08/2020 Location: United KingdomPosts: 411 |
Got my first Webmite up and running today. 5 mins of config and works as expected. My use case (mentioned in other threads) is to allow users to use the 'mite as a data logger of sorts - but they were struggling with XModem-ing the data off the 'mite. I now have up and running a web page with a "Download Data" button/link. Some tweaking of the MIME types: To explicitly deal with ".txt" file types CASE ".txt" WEB TRANSMIT FILE a%, file$, "text/plain" And adding the "download" attribute to the html link in the index.html: <a href ="temp.txt" download> DATA FILE HERE</a> ...forces the browser to open a file save dialogue so the user can save the file directly instead of navigating to the file. This circumvents any manual user interaction (no XMODEM, no TFTP) - works with TFTP off as this is a html/browser transfer of the file. As this was so easy - I wanted to display the latest sensor reading whilst the testing was underway. This too proved easy enough - adapt the html so that it forces a page reload ever n seconds: Added a <head> section... <head> <meta http-equiv="Refresh" content="2"> </head> In this case, content=2 -- refresh every 2 seconds. I know this is not Earth shattering coding, but it blows my mind how simple this was and a real credit to the work in developing this platform. Now off to code it more fully so that the use can turn on/off the GPIO pins and when N Entropy is not what it used to be |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 4954 |
Hi N, Just to educate use mere trainees, would it be possible to see a bit more of your code, not just the snippets. In case it is confidential, you might want to hide some lines in the code. But both the MMbasic as well as HTML files would be very educating for the simple minds like me (web simpleminds...) I know that people like myself (and Mick) have been struggling in getting our head around how to do things, to the point of giving up on webmite, looking at alternatives, or simply wiring it all up. Accepting that this web stuff is for the wizz kids. Thank you in advance, Volhout PicomiteVGA PETSCII ROBOTS |
||||
phil99![]() Guru ![]() Joined: 11/02/2018 Location: AustraliaPosts: 2508 |
Ditto. Sums it up for many I think. |
||||
Nimue![]() Guru ![]() Joined: 06/08/2020 Location: United KingdomPosts: 411 |
Of course - I initially shared in the form as I did because I was bowled over how easy it was - not because I thought it was innovative. I'll write it up fully. Nothing I cant can't share fully as at this stage it was proof of concept. N Entropy is not what it used to be |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |