main
Branches
main (2.16.8)dev
Versions
2.16.81.19.3v0.21.0
React Router v7 has been released. View the docs
unstable_createMemoryUploadHandler

unstable_createMemoryUploadHandler

This API is removed in React Router v7. See the React Router guide to file uploads for the recommended alternative API.

Example:

export const action = async ({  request, }: ActionFunctionArgs) => {  const uploadHandler = unstable_createMemoryUploadHandler({  maxPartSize: 500_000,  });  const formData = await unstable_parseMultipartFormData(  request,  uploadHandler  );   const file = formData.get("avatar");   // file is a "File" (https://mdn.io/File) polyfilled for node  // ... etc }; 

Options: The only options supported are maxPartSize and filter which work the same as in unstable_createFileUploadHandler above. This API is not recommended for anything at scale but is a convenient utility for simple use cases and as a fallback for another handler.

Docs and examples licensed under MIT