Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 07:49 07 Jun 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : WebMite (Pico 2) - File download

Author Message
Nimue

Guru

Joined: 06/08/2020
Location: United Kingdom
Posts: 411
Posted: 07:22pm 03 Jun 2025
Copy link to clipboard 
Print this post

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: Netherlands
Posts: 4954
Posted: 06:20am 04 Jun 2025
Copy link to clipboard 
Print this post

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: Australia
Posts: 2508
Posted: 07:37am 04 Jun 2025
Copy link to clipboard 
Print this post

Ditto.
Sums it up for many I think.
 
Nimue

Guru

Joined: 06/08/2020
Location: United Kingdom
Posts: 411
Posted: 08:11am 04 Jun 2025
Copy link to clipboard 
Print this post

  Volhout said  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...)

Volhout



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
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025