Asset Upload
How to upload assets to Omnium via external URLs, form files, and binary streams.
Omnium supports multiple methods for uploading assets. This page covers the upload mechanisms and best practices.
Upload Methods
Omnium provides three ways to upload assets:
| Method | Use Case | Input |
|---|---|---|
| External URL | Import from external source | URL to download |
| Form File | Browser upload | HTTP form file |
| Stream | Programmatic upload | Binary stream |
External URL Upload
The most common upload method. Omnium downloads the file from an external URL and stores it internally.
How It Works
- Provide an asset with
ExternalUrlset - Omnium downloads the file from the URL
- File is stored in Omnium's asset storage
- Asset's
Urlproperty is updated with the internal URL
Example
Input:
After Processing:
File Name Handling
The upload process determines the file name using this priority:
asset.FileNameif provided- Extracted from the URL path
- With content type extension added if missing
Always include the file extension in FileName to ensure correct MIME type handling. Files without extensions may not display correctly in browsers.
Form File Upload
Upload files directly from HTTP form submissions (browser uploads).
API Usage
Response
Returns the created asset with populated metadata:
Metadata Populated
| Property | Source |
|---|---|
Name | Original file name |
FileName | Original file name |
ContentType | From form file MIME type |
Length | File size in bytes |
AssetId | Auto-generated GUID |
Created | Current UTC time |
Modified | Current UTC time |
Stream Upload
Upload binary data directly from code, useful for programmatic file creation.
When to Use
- Generating files programmatically (PDFs, images)
- Processing binary data from external systems
- Converting between formats
Example Flow
Response Structure
Storage Containers
Assets are automatically organized into containers based on context:
| Container | Usage |
|---|---|
products | Product images and documents |
customer | Customer attachments |
projects | Project-related assets |
Container assignment is handled automatically by Omnium based on the upload context.
Virtual Folders
Assets are organized using virtual folder paths within containers:
Folder Naming
For product assets, the virtual folder name is:
Product.ProductIdif availableProduct.Idas fallback
Upload Behavior
Automatic Metadata
During upload, the following properties are automatically set:
| Property | Value |
|---|---|
Created | Current UTC time (if not already set) |
Modified | Current UTC time |
ContentType | Detected from file or provided |
Length | File size in bytes |
Url | Internal asset URL |
Name | Extracted from filename if not provided |
FileName | Extracted from blob name if not provided |
CDN URL Conversion
When a CDN is configured for your tenant, internal asset URLs are automatically converted to CDN URLs for faster delivery. This conversion happens in the mapping layer when returning assets via the API.
Error Handling
Upload operations may fail for several reasons:
| Error | Cause | Resolution |
|---|---|---|
| Empty URL | ExternalUrl is null or empty | Provide valid external URL |
| Download failed | External URL unreachable | Verify URL accessibility |
| Storage error | Storage service issue | Contact Omnium support |
| Invalid content | File is corrupted or invalid | Verify source file |
Failed uploads are typically logged but do not cause the entire product save to fail. Check asset URLs after save to verify successful uploads.
Best Practices
File Names
- Always include file extensions (
.jpg,.png,.pdf) - Use URL-safe characters (alphanumeric, hyphens, underscores)
- Avoid spaces and special characters
External URLs
- Use HTTPS URLs when possible
- Ensure URLs are publicly accessible (no authentication required)
- Verify URLs are stable (not temporary/signed)
Performance
- Use batch operations for multiple assets
- Take advantage of deduplication for shared images
- Consider CDN for production deployments
File Types
Common supported file types:
| Type | Extensions | Common MIME Types |
|---|---|---|
| Images | .jpg, .jpeg, .png, .gif, .webp | image/jpeg, image/png, image/gif, image/webp |
| Documents | .pdf, .doc, .docx | application/pdf, application/msword |
| Video | .mp4, .webm | video/mp4, video/webm |
Base64 Upload
For small files, you can upload using Base64-encoded content:
Base64 encoding increases data size by ~33%. For files larger than a few hundred KB, prefer external URL or stream uploads.
