Provider-upload-aws-s3

Change path before upload

I’m using @strapi/provider-upload-aws-s3(^4.10.5) to upload files to DO spaces. And it’s working fine even I was able to store the files to a subdirectory. But that’s not enough for me :disappointed:.I need to manage files in different folders.
What I’m looking for able to change the subdirectory on a specific condition. Is it possible ? need a litte help here. Thanks in advance.

./config/plugin.js

module.exports = ({env}) => ({
    upload: {
        config: {
            provider: 'aws-s3',
            providerOptions: {
               s3Options: {
                accessKeyId: env('DO_SPACE_ACCESS_KEY'),
                secretAccessKey: env('DO_SPACE_SECRET_KEY'),
                endpoint: env('DO_SPACE_ENDPOINT'),
                params: {
                    Bucket: env('DO_SPACE_BUCKET'),
                },
               }
            },
            actionOptions: {
                upload: {},
                uploadStream: {},
                delete: {},
            },
        },
    },
})

./config/middlewares.js

module.exports = [
  'strapi::errors',
  'strapi::security',
  'strapi::cors',
  'strapi::poweredBy',
  'strapi::logger',
  'strapi::query',
  'strapi::body',
  'strapi::session',
  'strapi::favicon',
  'strapi::public',
  {
    name: "strapi::security",
    config: {
      contentSecurityPolicy: {
        useDefaults: true,
        directives: {
          'connect-src': ["'self'", 'https:'],
          'img-src': [
            "'self'",
            'data:',
            'blob:',
            'dl.airtable.com',
            '*.digitaloceanspaces.com',
          ],
          'media-src': [
            "'self'",
            'data:',
            'blob:',
            'dl.airtable.com',
            '*.digitaloceanspaces.com',
          ],
          upgradeInsecureRequests: null,
        },
      }
    }
  },
];