A plugin that help you upload media to a specific folder using api in strapi.
- Upload files to a specific folder structure.
- Manage folders and files through API.
- Easy integration with Strapi projects.
npm i strapi-plugin-media-upload
After installation, the plugin will be automatically enabled.
Upload media files to a specific folder using the provided API endpoints.
GET /<strapiprefix>/media/folders
- Query Params:
- parentId (optional): ID of the parent folder, return root folders if not fill.
- sort[] (optional): e.g.sort[0]=createdAt:asc&sort[1]=updatedAt:desc
POST /<strapiprefix>/media/folder
- Request Body:
{ "name": "New Folder", // Required, folder name "parentId": 1 // Optional, ID of the parent folder }
PUT /<strapiprefix>/media/folder
- Request Body:
{ "id": 1, // Required, ID of the folder to update, "name": "New Folder", // Required, folder name "parentId": 1 // Optional, new parent folder ID }
DELETE /<strapiprefix>/media/folder
- Query Params:
- id: the id of folder should be deleted (attention: folders and files under this folder would be deleted by the way)
GET /<strapiprefix>/media/folder-structure
GET /<strapiprefix>/media/folder
- Query Params:
- id (optional): ID of the folder
POST /<strapiprefix>/media/bulk-delete
- Request Body:
{ "fileIds": [27], // Required, ID of the files to delete "folderIds": [20] // Required, ID of the folders to delete }
POST /<strapiprefix>/media/bulk-move
- Request Body:
{ "targetFolderId": 21, // Required, ID of the target folder, if not provided, the items would be move to the root folder. "fileIds": [27], // Required, ID of the files to delete "folderIds": [20] // Required, ID of the folders to delete }
POST /<strapiprefix>/media/upload
- Request Body:
- file (multipart/form-data): The file to upload.
- folderId (optional): ID of the folder where the file should be uploaded.
PUT /<strapiprefix>/media/update
- Request Body:
{ "id": 1, // Required, ID of the file to move, "name": "New Name", // Optional, new file name "alternativeText": "New Alternative Text", // Optional, new alternative text, "caption": "New Caption", // Optional, new caption, "folderId": 1, // Optional, folder id }
This plugin is compatible with Strapi 5.0.0
and above.
If you encounter any issues, please report them here.
This project is licensed under the MIT License. See the LICENSE file for details.
Eli Liu
Email: Mr.liu93@outlook.com
GitHub: Littlexiaoxiaojian