Skip to content

Commit 2ec80b3

Browse files
authored
Update file-upload.md (#1346)
1 parent b596c79 commit 2ec80b3

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

core/file-upload.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,19 @@ your data, you will get a response looking like this:
231231
}
232232
```
233233

234+
## Accessing Your Media Objects Directly
235+
236+
You will need to modify your Caddyfile to allow the above `contentUrl` to be accessed directly. If you followed the above configuration for the VichUploaderBundle, that will be in `api/public/media`. Add your folder to the list of path matches, e.g. `|^/media/|`:
237+
```caddyfile
238+
...
239+
# Matches requests for HTML documents, for static files and for Next.js files,
240+
# except for known API paths and paths with extensions handled by API Platform
241+
@pwa expression `(
242+
{header.Accept}.matches("\\btext/html\\b")
243+
&& !{path}.matches("(?i)(?:^/docs|^/graphql|^/bundles/|^/media/|^/_profiler|^/_wdt|\\.(?:json|html$|csv$|ya?ml$|xml$))")
244+
...
245+
```
246+
234247
## Linking a MediaObject Resource to Another Resource
235248

236249
We now need to update our `Book` resource, so that we can link a `MediaObject`

0 commit comments

Comments
 (0)