﻿# Multipart uploads: a client filename is not a server storage path

Separate multipart field names, client filenames and server artifact identity, preserving boundary handling and inspecting upload metadata before storage.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/guide-multipart-filename-storage-identity/
Language: en

## Multipart has several independent names

A multipart form part can carry a field name and a filename. The field name associates the part with an API input, while the filename describes the caller's file. Neither automatically establishes the server's artifact identifier or destination directory.

For a dataset or model upload, a proposed API preserves an original display name separately from its generated storage identity. This avoids making an externally supplied name responsible for uniqueness, tenant separation or the location at which an executable process later opens the artifact.

## The specification rejects blind path use

The multipart form-data specification tells receivers not to use a supplied filename blindly and not to use included directory path information. A validly parsed multipart request therefore still needs application-level handling of the metadata.

Decide what names may be displayed and how they are normalized for that purpose. Storage should follow the application's defined artifact policy. Removing one path separator is not a complete definition of safe behavior across different filesystem conventions or later consumers.

## Framework attributes expose metadata, not acceptance

FastAPI documents UploadFile attributes including filename and content_type, as well as a spooled file interface. These attributes make the received upload accessible; they do not establish that the content matches a claimed model format or that its name is suitable for a destination path.

A proposed processing pipeline separates receipt, content inspection and artifact acceptance. An upload can be received successfully while its declared type or downstream format remains unsupported. Preserve that distinction in the application's state and error contract.

## Boundaries belong to the multipart encoder

MDN's FormData guidance warns against manually setting Content-Type when a browser must supply its multipart boundary. The body and header must describe the same framing. A JSON-style habit of forcing one fixed header can prevent an otherwise valid file upload from being parsed.

This is a transport-format issue, separate from the filename policy. Check both layers independently rather than diagnosing every missing file as a storage permission problem or every strange filename as a malformed multipart body.

## Repeated fields and revisions need explicit policy

The specification describes multiple files for one field as separate parts sharing the field name. A consumer that assumes unique names can lose items or choose an unintended last value. Define whether the endpoint accepts one file, a list or a structured manifest.

A proposed review includes repeated fields, absent filenames, non-ASCII display names and client names containing directory information. The aim is a clear artifact interface in which transport parsing does not silently grant caller-controlled storage semantics.

## Primary references

[Multipart form-data specification](https://www.rfc-editor.org/rfc/rfc7578.html).

[FastAPI uploaded-file interface](https://fastapi.tiangolo.com/tutorial/request-files/).

[Browser FormData guidance](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest_API/Using_FormData_Objects).

Related explanations: [Model artifact storage](/journal/gpu-cloud-s3-model-cache-storage/); [Transport and body limits](/journal/provider-request-body-size-limits/).
