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 uploading
final uploadUrl = await logo.getUploadUrl(expiry: 300);

Parameters

  • Name
    expiry
    Optional
    Optional
    Type
    int
    Description

    Seconds until link expiry. Defaults to 600, Maximum of 604800 (7 days).

Examples

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 uploading
final uploadUrl = await logo.getUploadUrl(expiry: 300);
Last updated on Oct 15, 2024