Iskra API Reference
    Preparing search index...

    Interface UploadConfig

    interface UploadConfig {
        allowedExtensions?: string[];
        authorize?: (
            c: Context,
            action: UploadAction,
            target?: UploadTarget,
        ) => boolean | Promise<boolean>;
        exposeRoutes?: boolean;
        maxFileSize?: number;
        overwrite?: boolean;
        projectName: string;
        routePrefix?: string;
    }
    Index
    allowedExtensions?: string[]

    Extensions the upload route accepts (e.g. ['.jpg', '.png']). Without it, any extension but those of active web content (.html, .svg, .xml, .js...), which a browser runs wherever the file is served inline; list one here to accept it.

    authorize?: (
        c: Context,
        action: UploadAction,
        target?: UploadTarget,
    ) => boolean | Promise<boolean>

    Required with exposeRoutes: whether the request may perform action on the built-in upload routes (e.g. check c.get("user")). Pass () => true to make them public on purpose. target is the file or folder the action touches; upload is asked twice: first without a target, before the body is read, then with it, before the file is written.

    exposeRoutes?: boolean
    maxFileSize?: number

    Largest file the upload route accepts, in bytes (default 10 MiB). With exposeRoutes it must fit, plus 64 KiB of multipart overhead, in the Kernel's maxRequestBodySize (16 MiB by default): initialize() fails otherwise.

    overwrite?: boolean

    Whether the upload route may replace a file stored under the same name (default false: 409).

    projectName: string
    routePrefix?: string