Local File Module Provider

The Local File Module Provider stores files uploaded to your Medusa application in the /uploads directory.

Warning: 
  • The Local File Module Provider is only for development purposes. Use the S3 File Module Provider in production instead.
  • The Local File Module Provider will only read files uploaded through Medusa. It will not read files uploaded manually to the static (or other configured) directory.

Register the Local File Module#

Note: The Local File Module Provider is registered by default in your application.

Add the module into the providers array of the File Module:

Note: The File Module accepts one provider only.
medusa-config.ts
1import { Modules } from "@medusajs/framework/utils"2
3// ...4
5module.exports = {6  // ...7  modules: [8    {9      resolve: "@medusajs/medusa/file",10      options: {11        providers: [12          {13            resolve: "@medusajs/medusa/file-local",14            id: "local",15            options: {16              // provider options...17            },18          },19        ],20      },21    },22  ],23}

Local File Module Options#

OptionDescriptionDefault

upload_dir

The directory to upload files to. Medusa exposes the content of the static directory publically. If you change the directory, it must be served and publically accessible.

static

backend_url

The URL that serves the files.

http://localhost:9000/static

Was this page helpful?
Ask Anything
FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break