Skip to main content

POST /api/upload

Uploads one or more images to the photo frame collection. Requires admin authentication.
This is a protected endpoint. You must be logged in as admin to upload images.

Request

file[]
required
One or more image files to upload
string
Target folder path. If not specified, uploads to root directory.

Request Example

Single File
Multiple Files with Folder

Response

File Restrictions

Limit
Maximum 10MB per file (configurable via MAX_FILE_SIZE env var)
Allowed
JPEG, PNG, GIF, WebP images only
Limit
No hard limit, but large batches may timeout

Status Codes

Success
Files uploaded successfully
Bad Request
Invalid file format or missing files
Unauthorized
Admin authentication required
Payload Too Large
File size exceeds maximum limit
Server Error
Upload processing or file system error

JavaScript Example

Folder Creation

  • Target folders are created automatically if they don’t exist
  • Nested folder paths are supported (e.g., vacation/2023/summer)
  • Use forward slashes for folder separators
  • Folder names cannot contain special characters: < > : " | ? * \