createDirectFileUploadDescription method

Future<String?> createDirectFileUploadDescription({
  1. required String storageId,
  2. required String path,
})

Creates a new file upload description, that can be passed to the client's FileUploader. After the file has been uploaded, the verifyDirectFileUpload method should be called, or the file may be deleted.

Implementation

Future<String?> createDirectFileUploadDescription({
  required String storageId,
  required String path,
}) async {
  var storage = _session.server.serverpod.storage[storageId];
  if (storage == null) {
    throw CloudStorageException('Storage $storageId is not registered');
  }

  return await storage.createDirectFileUploadDescription(
      session: _session, path: path);
}