Skip to content
ABFree Studio

How to Configure Custom Upload Endpoints

If you have your own upload service, you can use it directly to receive images.

How to Receive Images

We send images via POST request, with the request body containing the image’s binary data and metadata.

Using honojs as an example, we get image information from formData:

app.post("/upload", async (c) => {
const formData = await c.req.parseBody();
const file = formData.file;
if (!(file instanceof File)) {
return c.json({ error: "Invalid file" }, 400);
}
console.log("size:", file.size, "name:", file.name,"file type :", file.type);
// your custom upload logic
return c.json({
url: "test",
});
});

How to Return Data

Please ensure the API returns a 200 status code and Content-Type: application/json

Your API response body must include the following parameter:

{"url":"your image url"}

© 2024 ABFree Co. All rights reserved.