NewWacht Bench is live — AI-assisted development for Wacht

uploadImage()

Uploads a file via multipart form-data and returns a hosted image URL.

Usage

The following example shows a basic usage of the backend client from @wacht/nextjs/server.

import { wachtClient } from '@wacht/nextjs/server';export async function uploadLogo(file: File) {  const client = await wachtClient();  return client.utility.uploadImage('logo', file);}

Signature

function uploadImage(  imageType: 'logo' | 'favicon' | 'user-profile' | 'org-profile' | 'workspace-profile',  file: File,): Promise<{ url: string }>

Parameters

imageType: 'logo' | 'favicon' | 'user-profile' | 'org-profile' | 'workspace-profile';
Target image category.
file: File;
Image file payload (multipart upload).

Return value

url?: string | undefined;
Hosted CDN URL for uploaded image.

Behavior

  • Uploads multipart image content and returns a hosted URL reference.
  • Ensure file type and size validation in caller code before sending uploads.

On this page