Creating a custom /upload endpoint in my controller

I have managed to fix it. Here is what I have done:

async uploadSignedOfferte(ctx) {
	  try {
		const {
		  request: { body, files: { files } = {} },
		} = ctx;
		
			const data = {
			  fileInfo: { caption: undefined, alternativeText: undefined, name: undefined }
			};
			if (Array.isArray(files)) {
			  data.fileInfo = data.fileInfo || [];
			  data.fileInfo = files.map((_f, i) => ({ ...data.fileInfo[i], folder: 1 }));
			} else {
			  data.fileInfo = { ...data.fileInfo, folder: 1 };
			}
			if (files) {
			  const uploadedFile = await strapi.service("plugin::upload.upload").upload({
				  data,
				  files
			  });
			  return uploadedFile;
			} else {
				return ctx.send({ error: 'There is no file uploaded' }, 400);
			}
	  } catch (error) {
		console.error(error);
		return ctx.send({ error: 'Error uploading files' }, 500);
	  }
	}

Number 1 is my API upload folder ID. Hope someone find this helpful because Strapi documentation doesn’t mention anything about it.