Skip to main content
PocketBase provides comprehensive file system utilities through the $filesystem and $os namespaces for managing files, uploads, and storage.

Creating files

From local path

From bytes

From URL

From multipart upload

File storage backends

PocketBase supports local and S3-compatible storage backends.

Local storage

S3 storage

Record file operations

Get file URLs

Upload files in hooks

Delete files

OS file operations

The $os namespace provides low-level file system operations.

Read files

Write files

Directory operations

File info

File paths

Use $filepath for path manipulation:

Working with custom storage

Save files to custom location

Serve custom files

Image processing

PocketBase automatically generates thumbnails for images when configured in file fields.

Configure thumbnails

Access thumbnails

File validation

Validate file type

Validate file size

Examples

Batch file upload

Generate file report