File Upload & Signature
File upload and signature capture flows in the patient UI, including S3 integration.
👤 Ritu Kataria📅 Updated: Mar 13, 2026🏷️ feature
File Upload & Signature
Both file uploads and signature capture follow a presigned S3 URL pattern — the patient UI never sends binary data through the application server.
Signature — CustomSignature
Library: react-signature-canvas
Flow:
- Patient draws signature on the canvas
- On stroke completion, canvas is converted to a JPEG data URL
- On Save:
- Fetch presigned URL from
POST /api-v3/generate-presigned-url/ - Convert data URL → Blob → File
PUTfile directly to S3 presigned URL- Call
onChange(fieldId, { bucketPath: s3Key, value: dataUrl }) - Reconcile via
POST /sm_reconcile_presigned_url/
- Fetch presigned URL from
- S3 path:
consent/<patient_id>/with a UUID filename
Value stored in Redux: { bucketPath: "<s3-key>", value: "<data-url>" }
File Upload — Upload
Supports three input modes: standard file input, webcam capture (Camera), and image selection.
Validation (pre-upload):
- File count:
min_number_upload_file/max_number_upload_file - File size:
file_sizeattribute - Duplicate detection (by filename)
Upload flow (per file):
POST /api-v3/generate-presigned-url/— get S3 presigned upload URLPUTdirectly to S3 presigned URLPOST /sm_reconcile_presigned_url/— confirm upload and reconcile file path
Value stored in Redux: { [fileName]: s3Key } map
API Calls for Uploads
| Endpoint | Purpose |
|---|---|
POST /api-v3/generate-presigned-url/ | Get S3 presigned upload URL |
PUT {presigned-url} | Upload file directly to S3 |
POST /sm_reconcile_presigned_url/ | Confirm upload and reconcile file path |