Creating a custom /upload endpoint in my controller

where I can write this code? also, can you share the full code