You need to create a widget and map it in the variable to get it working in portal.

 

You can use the widget from the below link.

https://serviceportal.io/downloads/require-attachments/