Hello @sunnyson, I have a question, is this process will work when deploying to production? In my case, it’s not. I don’t know why, it only works on the development side.
async uploadFiles(ctx) {
const {
state: { userAbility, user },
request: { body, files: { files } = {} },
} = ctx;
const uploadService = strapi.plugins.upload.services.upload;
const pm = strapi.admin.services.permission.createPermissionsManager({
ability: userAbility,
action: ACTIONS.create,
model: fileModel,
});
if (!pm.isAllowed) {
throw strapi.errors.forbidden();
}
const data = await validateUploadBody(body);
if (ctx.request.header['content-length'] > 10000000) {
throw strapi.errors.badRequest('Image must not exceed to 10MB');
}
const uploadedFiles = await uploadService.upload({ data, files }, { user });
ctx.body = pm.sanitize(uploadedFiles, { action: ACTIONS.read, withPrivate: false });
},
};
This is the path that I pasted the code from the admin.js in node_module (strapi-plugin-upload)

This is the sample that only works on development side but not in production

Note: I’m using Cloudinary in media uploading.