Files
.github
.storybook
__mocks__
cypress
dev-test
functions
img
packages
scripts
website
content
blog
docs
widgets
boolean.md
code.md
color.md
date.md
datetime.md
file.md
hidden.md
image.md
list.md
map.md
markdown.md
number.md
object.md
relation.md
select.md
string.md
text.md
add-to-your-site.md
architecture.md
azure-backend.md
backends-overview.md
beta-features.md
bitbucket-backend.md
cloudinary.md
collection-types.md
configuration-options.md
contributor-guide.md
custom-widgets.md
customization.md
deploy-preview-links.md
examples.md
external-oauth-clients.md
gatsby.md
git-gateway-backend.md
github-backend.md
gitlab-backend.md
gridsome.md
hugo.md
intro.md
jekyll.md
middleman.md
netlify-large-media.md
nextjs.md
nuxt.md
open-authoring.md
releases.md
site-generator-overview.md
start-with-a-template.md
test-backend.md
uploadcare.md
widgets.md
writing-style-guide.md
pages
.keep
data
src
static
.babelrc
.gitignore
.markdownlint.json
.nvmrc
README.md
gatsby-browser.js
gatsby-config.js
gatsby-node.js
netlify.toml
package.json
site.yml
yarn.lock
.all-contributorsrc
.editorconfig
.eslintrc.js
.gitattributes
.gitignore
.nvmrc
.prettierignore
.prettierrc
.stylelintrc
.vale.ini
CHANGELOG.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md
LICENSE
README.md
babel.config.js
cms.png
commitlint.config.js
cypress.json
jest.config.js
lerna.json
netlify.toml
package.json
renovate.json
setupTestFramework.js
tsconfig.json
yarn.lock
static-cms/website/content/docs/widgets/file.md

32 lines
1.5 KiB
Markdown
Raw Normal View History

---
title: file
label: File
---
The file widget allows editors to upload a file or select an existing one from the media library. The path to the file will be saved to the field as a string.
* **Name:** `file`
* **UI:** file picker button opens media gallery
* **Data type:** file path string
* **Options:**
* `default`: accepts a file path string; defaults to null
* `media_library`: media library settings to apply when a media library is opened by the
2018-12-04 17:04:52 -05:00
current widget
* `allow_multiple`: *(default: `true`)* when set to `false`, prevents multiple selection for any media library extension, but must be supported by the extension in use
* `config`: a configuration object that will be passed directly to the media library being
2018-12-04 17:04:52 -05:00
used - available options are determined by the library
* `media_folder` (Beta): file path where uploaded files will be saved specific to this control. Paths can be relative to a collection folder (e.g. `files` will add the file to a sub-folder in the collection folder) or absolute with reference to the base of the repo which needs to begin with `/` (e.g `/static/files` will save uploaded files to the `static` folder in a sub folder named `files`)
* `choose_url`: *(default: `true`)* when set to `false`, the "Insert from URL" button will be hidden
* **Example:**
```yaml
- label: "Manual PDF"
name: "manual_pdf"
widget: "file"
default: "/uploads/general-manual.pdf"
media_library:
config:
multiple: true
```