Smart Media Upload
An advanced Strapi v5 plugin to upload files directly to specific Media Library folders via a dedicated API.
Strapi Plugin Smart Media Upload (v5)
An advanced Strapi v5 plugin that provides an intelligent API endpoint for direct file uploads to specific folders in the Media Library.
Features
- Precise Folder Targeting: Automate file organization by uploading directly to any
folderId. - Dedicated API Endpoint: Clean and separate
POST /api/smart-media-upload/upload-file. - Strapi v5 Native: Leveraging the latest Strapi architecture for maximum performance.
- Robust Multi-part Detection: Smartly handles
fileandfilespayloads. - Developer Friendly: Simplified integration for mobile apps and external frontends.
Installation
# Using pnpm
pnpm add strapi-plugin-smart-media-upload
# Using npm
npm install strapi-plugin-smart-media-uploadConfiguration
Enable the plugin in config/plugins.ts:
export default {
// ...
'smart-media-upload': {
enabled: true,
},
// ...
};Usage
Direct Upload via API
Send a POST request to /api/smart-media-upload/upload-file with multipart/form-data.
Body Parameters:
file(File): The file you want to upload.folderId(string/number, optional): The ID of the folder in the Media Library where the file should be saved.
Example with Fetch:
const formData = new FormData();
formData.append('file', fileInput.files[0]);
formData.append('folderId', '4');
const response = await fetch('http://localhost:1337/api/smart-media-upload/upload-file', {
method: 'POST',
body: formData,
});
const data = await response.json();
console.log(data);Permissions
By default, the endpoint is public (auth: false). You can customize this in the plugin's route configuration if you need to restrict access to authenticated users or specific roles.
License
MIT
Install now
npm install strapi-plugin-smart-media-upload
Create your own plugin
Check out the available plugin resources that will help you to develop your plugin or provider and get it listed on the marketplace.