0

I'm trying to create an application where a file which has selected via drag and drop box should be downloaded into the c drive (later into the server). I'm using a blob object in the download function and it works well. The problem is that the downloaded file appears in a new tab and I don't know how to insert the file into a folder in the c drive instead.

Here is my function. It works well, but how to save the blob object into a folder in c drive?

function saveFileX() {
  const savedFileX = document.getElementById("fileX");
  const savedObject = savedFileX.files[0];
  const blob = new Blob([savedObject], {
    type: "application/octet-stream"
  });
  const href = URL.createObjectURL(blob);
  const a = Object.assign(document.createElement("a"), {
    href,
    style: "display:none",
    download: blob
  });

  document.body.appendChild(a);
  a.click();
  URL.revokeObjectURL(href);
  a.remove();

}
mplungjan
  • 169,008
  • 28
  • 173
  • 236
Ari R
  • 11
  • 2

0 Answers0