Getting started
Upload several files in sequence
Example of how to iterate over a file list and call upload() for each one, with the session guaranteed on page load.
1 min read
upload() accepts a single File per call. To send several files — for example, every file chosen in an <input type="file" multiple> — iterate over the list and call upload() for each one.
Example
html
<script src="https://cdn.infinity6.ai/releases/sdkweb/latest/bundle/i6sdk-web.js"></script>
<script type="module">
const sdk = window.I6Sdk;
async function main() {
// Guarantee the session before any upload.
const user = await sdk.auth().requireUser();
if (!user) return;
document.querySelector("#files").addEventListener("change", async (event) => {
for (const file of event.target.files) {
try {
await sdk.ingest().upload({
dataset: "<your-dataset>",
table: "<your-table>",
partitions: { "<your-key>": "<your-value>" },
file,
});
console.log(`Uploaded: ${file.name}`);
} catch (error) {
console.error(`Failed on ${file.name}:`, error);
}
}
});
}
main();
</script>Points of attention
- Uploads happen in sequence, one at a time, which makes it easier to identify which file failed and resume from it.
- Each iteration has its own
try/catch, isolating errors per file so a single failure does not interrupt the upload of the remaining files.
Full reference
Support
Implementation support
Official channels for questions during integration.
Response within 1 business day
Technical support email
Send implementation questions with the context of your current step.
Coming soon
Direct assistance for quick integration questions.
Coming soon
Support assistant
i6 documentation and implementation assistant.
