MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / GetUploadUrl

Method GetUploadUrl

docs/test-csharp-snippets/Module.cs:305–318  ·  view source on GitHub ↗

Procedure returns a pre-signed URL for client-side upload

(
        ProcedureContext ctx,
        string filename,
        string contentType)

Source from the content-addressed store, hash-verified

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]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected