HTML file upload


If you are asking a question, please follow this template:

  1. My goal is: [describe your goal]
    to replace or add a file to the fs directory via HTML post or command

  2. My actions are: [describe your actions - code, commands, etc]
    one of my attempts:

  3. The result I see is: [show the result - log, etc]
    all attempts have either done nothing (with no obvious errors or have given me a 404 or 500 html error

  4. My expectation & question is: [describe your expectation and your question]
    see goal in step 1. What is the correct format of the post command to get get the file from the client and upload (post) it to the fs directory of my device?


Call FS.Put RPC function. If the file is too big, chunk it.


Understood. I’m looking for the syntax of the call to put in the HTML file. I really just need something that does the same thing as mos put filename to copy a text file to the fs directory.


Something like this:'/rpc/FS.Put', {filename: 'a.txt', append: false, data: atob('hello')})
  .then((res) => console.log(;

I assume from that I have to get the data from the client then too. Do I also have to transform the data in any way (it’s ASCII plain text). And if so, how do I get it back to plain text in the fs directory? Or is that automatically?