diff --git a/client/src/common/utils/file.js b/client/src/common/utils/file.js new file mode 100644 index 0000000..b29c72c --- /dev/null +++ b/client/src/common/utils/file.js @@ -0,0 +1,12 @@ +export const uploadString = () => new Promise((resolve) => { + const input = document.createElement("input"); + input.type = "file"; + input.accept = "text/plain"; + input.onchange = (e) => { + const file = e.target.files[0]; + const reader = new FileReader(); + reader.onload = (e) => resolve(e.target.result); + reader.readAsText(file); + }; + input.click(); +}); \ No newline at end of file