0

I'm using the below code

HTML Code

<input type="file" id="fileDialog" style="opacity: 0">

JS Code

event.preventDefault();
$("#fileDialog").trigger('click');

But this is opening File Explorer as shown in image File Explorer

I want to open a File Explorer with Save Button not an open Button, can anyone help me with this please

amanbisht39
  • 73
  • 1
  • 7
  • Does this answer your question? [JavaScript: Create and save file](https://stackoverflow.com/questions/13405129/javascript-create-and-save-file) – Rojo Apr 29 '21 at 17:44

1 Answers1

0

I think that web pages open Save dialog only when the user wants to download something. The page have not access to the file system of the local computer. If want to save something js do it in browsers storage eg. indexed db, cookie, session storage... eg.:

      let p = { color: 'yellow' };
      let key = 'color';
      localStorage.setItem(key, JSON.stringify(p));