CKEditor5.Upload.Controller (ckeditor5_phoenix v1.16.1)

View Source

Controller for handling image uploads from CKEditor 5.

This controller provides a simple upload endpoint that saves uploaded files.

Configuration

You can configure the upload directory and the base URL for the uploaded files in your config.exs:

config :ckeditor5_phoenix, :uploads,
  folder: "priv/static/uploads",
  url: "/uploads"

Usage

Add this to your router:

scope "/api/ckeditor5" do
  post "/upload", CKEditor5.Upload.Controller, :upload
end

Summary

Functions

Handles file upload from CKEditor 5.

Functions

upload(conn, arg2)

Handles file upload from CKEditor 5.

Expects a multipart/form-data request with a "file" parameter. Returns JSON with the uploaded file URL or an error message.