Dart - bucket.file.getUploadUrl()
Create an upload URL for a file within a bucket.
import 'package:nitric_sdk/nitric.dart';final assets = Nitric.bucket("assets").allow([BucketPermission.write,]);final photo = assets.file("images/logo.png");// Create a write-only url reference for uploadingfinal uploadUrl = await logo.getUploadUrl(expiry: 300);
Parameters
- Name
expiry
- Optional
- Optional
- Type
- int
- Description
Seconds until link expiry. Defaults to
600
, Maximum of604800
(7 days).
Examples
Create a temporary file upload link for a user
import 'package:nitric_sdk/nitric.dart';final assets = Nitric.bucket("uploads").allow([BucketPermission.write,]);final photo = assets.file("images/logo.png");// Create a write-only url reference for uploadingfinal uploadUrl = await logo.getUploadUrl(expiry: 300);
Last updated on Oct 15, 2024