Constructor
new WaiverUploadController()
Members
ALLOWED_TYPES
Allowed MIME types for uploads (images and PDFs)
MAX_FILE_SIZE
Maximum file size in bytes (25MB)
Methods
connect()
Initialize controller
escapeHtml(text) → {string}
Escape HTML to prevent XSS
| Name | Type | Description |
|---|---|---|
text | string | Text to escape |
Escaped text
- Type:
- string
formatFileSize(bytes) → {string}
Format file size for display
| Name | Type | Description |
|---|---|---|
bytes | number | File size in bytes |
Formatted file size
- Type:
- string
handleFileSelect(event)
Handle file selection from input
| Name | Type | Description |
|---|---|---|
event | Event | File input change event |
handleSubmit(event)
Handle form submission
| Name | Type | Description |
|---|---|---|
event | Event | Form submit event |
hidePreview()
Hide file preview area
removeFile(index)
Remove a file from selection
| Name | Type | Description |
|---|---|---|
index | number | File index to remove |
showPreview()
Show file preview area with selected files
simulateProgress()
Simulate upload progress (since conversion is synchronous)
updateProgress(percent)
Update progress bar
| Name | Type | Description |
|---|---|---|
percent | number | Progress percentage (0-100) |
validateFile(file) → {Object}
Validate a single file
| Name | Type | Description |
|---|---|---|
file | File | File to validate |
Validation result {valid: boolean, error: string}
- Type:
- Object