Table of Contents
Working with Files
Files in Val
Val supports generic file uploads for any file type, including videos, PDFs, audio files, and more. Files work similarly to images but with more flexibility in file types.
Defining File Schema
Use `s.file()` to define a file field in your schema. You can optionally specify accepted file types:
Using Local Files
Local files are stored in the `/public/val` folder. Use `c.file()` to reference them:
Using Remote Files
Enable remote files by adding `.remote()` to your schema. Then use `c.remote()` to reference external URLs:
Rendering Files
Files are returned as URL strings that you can use directly in your components:
Video Files in Val Studio
When you use `s.file({ accept: 'video/*' })`, Val Studio will recognize it as a video file and provide a video preview in the editor. This makes it easier to manage video content.
File Storage
Like images, local files must be stored in the `/public/val` directory. When editors upload files through Val Studio, they are automatically saved to this location.