Procedure returns a pre-signed URL for client-side upload
(
ProcedureContext ctx,
string filename,
string contentType)
| 303 | |
| 304 | // Procedure returns a pre-signed URL for client-side upload |
| 305 | [SpacetimeDB.Procedure] |
| 306 | public static UploadInfo GetUploadUrl( |
| 307 | ProcedureContext ctx, |
| 308 | string filename, |
| 309 | string contentType) |
| 310 | { |
| 311 | var timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(); |
| 312 | var s3Key = $"uploads/{timestamp}-{filename}"; |
| 313 | |
| 314 | // Generate pre-signed URL (requires AWS credentials and signing logic) |
| 315 | var uploadUrl = GeneratePresignedUrl(s3Key, contentType); |
| 316 | |
| 317 | return new UploadInfo { UploadUrl = uploadUrl, S3Key = s3Key }; |
| 318 | } |
| 319 | |
| 320 | // Client uploads directly to S3 using the pre-signed URL, then calls: |
| 321 | [SpacetimeDB.Reducer] |
nothing calls this directly
no outgoing calls
no test coverage detected