dadada / index.html
multimodalart's picture
Update index.html
9cc9e49
raw
history blame
814 Bytes
<input type="file" id="fileInput" multiple>
<button onClick="upload()">Upload</button>
<script>
// Assumes that the `uploadFiles`, `repo`, and `credentials` are available in this scope
async function upload() {
const input = document.getElementById('fileInput');
const files = Array.from(input.files); // Convert FileList to an Array
// Prompt the user for a unique upload path for each file
const filesToUpload = await Promise.all(files.map(async (file) => {
const path = prompt(`Enter the upload path for ${file.name}`);
return {
path,
content: file,
};
}));
await uploadFiles({
repo,
credentials,
files: filesToUpload,
});
}
</script>