Files
medusa-store/www/apps/resources/app/infrastructure-modules/file/local/page.mdx
Shahed Nasser 04acc5d219 docs: update examples in sendgrid guide (#12504)
* initial

* docs: update examples in sendgrid guide

* add note for local file module
2025-05-15 19:13:15 +03:00

109 lines
2.2 KiB
Plaintext

import { Table } from "docs-ui"
export const metadata = {
title: `Local File Module Provider`,
}
# {metadata.title}
The Local File Module Provider stores files uploaded to your Medusa application in the `/uploads` directory.
<Note type="warning">
- The Local File Module Provider is only for development purposes. Use the [S3 File Module Provider](../s3/page.mdx) 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.
</Note>
---
## Register the Local File Module
<Note>
The Local File Module Provider is registered by default in your application.
</Note>
Add the module into the `providers` array of the File Module:
<Note>
The File Module accepts one provider only.
</Note>
```ts title="medusa-config.ts"
import { Modules } from "@medusajs/framework/utils"
// ...
module.exports = {
// ...
modules: [
{
resolve: "@medusajs/medusa/file",
options: {
providers: [
{
resolve: "@medusajs/medusa/file-local",
id: "local",
options: {
// provider options...
},
},
],
},
},
],
}
```
### Local File Module Options
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>Option</Table.HeaderCell>
<Table.HeaderCell>Description</Table.HeaderCell>
<Table.HeaderCell>Default</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
`upload_dir`
</Table.Cell>
<Table.Cell>
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.
</Table.Cell>
<Table.Cell>
`static`
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`backend_url`
</Table.Cell>
<Table.Cell>
The URL that serves the files.
</Table.Cell>
<Table.Cell>
`http://localhost:9000/static`
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>