Raw
1 import { Table } from "docs-ui"
2
3 export const metadata = {
4 title: `Local File Module Provider`,
5 }
6
7 # {metadata.title}
8
9 The Local File Module Provider stores files uploaded to your Medusa application in the `/uploads` directory.
10
11 <Note type="warning">
12
13 - The Local File Module Provider is only for development purposes. Use the [S3 File Module Provider](../s3/page.mdx) in production instead.
14 - 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.
15
16 </Note>
17
18 ---
19
20 ## Register the Local File Module
21
22 <Note>
23
24 The Local File Module Provider is registered by default in your application.
25
26 </Note>
27
28 Add the module into the `providers` array of the File Module:
29
30 <Note>
31
32 The File Module accepts one provider only.
33
34 </Note>
35
36 ```ts title="medusa-config.ts"
37 import { Modules } from "@medusajs/framework/utils"
38
39 // ...
40
41 module.exports = {
42 // ...
43 modules: [
44 {
45 resolve: "@medusajs/medusa/file",
46 options: {
47 providers: [
48 {
49 resolve: "@medusajs/medusa/file-local",
50 id: "local",
51 options: {
52 // provider options...
53 },
54 },
55 ],
56 },
57 },
58 ],
59 }
60 ```
61
62 ### Local File Module Options
63
64 <Table>
65 <Table.Header>
66 <Table.Row>
67 <Table.HeaderCell>
68 Option
69 </Table.HeaderCell>
70 <Table.HeaderCell>
71 Description
72 </Table.HeaderCell>
73 <Table.HeaderCell>
74 Default
75 </Table.HeaderCell>
76 </Table.Row>
77 </Table.Header>
78 <Table.Body>
79 <Table.Row>
80 <Table.Cell>
81
82 `upload_dir`
83
84 </Table.Cell>
85 <Table.Cell>
86
87 The directory to upload files to. Medusa exposes the content of the `static` directory publicly. If you change the directory, it must be served and publicly accessible.
88
89 </Table.Cell>
90 <Table.Cell>
91
92 `static`
93
94 </Table.Cell>
95 </Table.Row>
96 <Table.Row>
97 <Table.Cell>
98
99 `backend_url`
100
101 </Table.Cell>
102 <Table.Cell>
103
104 The URL that serves the files.
105
106 </Table.Cell>
107 <Table.Cell>
108
109 `http://localhost:9000/static`
110
111 </Table.Cell>
112 </Table.Row>
113 </Table.Body>
114 </Table>