Delete API

Last updated


This page explains how DELETE /del/{path} moves files or folders into the trash, and how to restore them.

Request


ItemValue
MethodDELETE
Path/del/{path}, where {path} is a file or folder under storage/image/upload/; a trailing / is stripped
BodyNot needed

Move Rules


RuleBehavior
Destinationstorage/image/upload/.trash/{YYYY-MM-DD}/{last segment}
DateUTC date (toISOString())
Name collisionWhen the destination exists, _{millisecond timestamp} is appended; files keep their extension (a_1791311009904.jpg), folders get it appended directly (x_1791311009904)

Responses


StatusTypeBody
200JSON{ "success": 1, "message": "檔案已移動至垃圾桶: {absolute server path}" }
200JSONFolder: 檔案夾已移動至垃圾桶: {absolute server path}
400Text未指定檔案/檔案夾
404Text檔案/檔案夾不存在
500TextSystem error message

Examples


  1. # Delete a file
  2. curl -fsS -X DELETE \
  3. http://localhost:8080/del/blog/2025/ERftP1gTS7WCTeJ8_1744080848530.jpg
  4. # Delete a whole folder
  5. curl -fsS -X DELETE http://localhost:8080/del/blog/2025

Restore


Move the item from the trash back to its original path (with Docker Compose the host path is ./image/):
  1. mv ./image/upload/.trash/2026-10-06/ERftP1gTS7WCTeJ8_1744080848530.jpg \
  2. ./image/upload/blog/2025/
中文