Skip to main content
Upload files from your local filesystem to sandboxes. This is useful for transferring data files, scripts, or any local files you want to use in your sandbox.

Overview

File uploading is ideal for:
  • Transferring local data files to sandboxes
  • Uploading scripts and code files
  • Moving configuration files
  • Transferring datasets or models
Upload supports both text and binary files. Large files may take longer to upload - set appropriate timeouts for large transfers.

Basic Upload

Upload a file from local to sandbox:

Upload with Timeout

Set timeout for large file uploads:

Upload Multiple Files

Upload multiple files in a loop:

Upload Binary Files

Upload binary files (images, PDFs, etc.):

Upload to Specific Directory

Upload files to specific directories:

Error Handling

Handle upload errors:

Complete Example

Here’s a complete upload workflow:

Best Practices

1

1. Check Local File Existence

Always verify local files exist before attempting upload to avoid errors.
2

2. Set Appropriate Timeouts

For large files, set extended timeouts (60+ seconds) to avoid connection timeouts.
3

3. Create Directories First

Use files.mkdir() to create target directories before uploading files.
4

4. Handle Errors Gracefully

Wrap uploads in try/catch blocks to handle network errors, file not found, etc.
5

5. Verify Uploads

After uploading, verify files exist and check their sizes to ensure successful transfer.

Next Steps