Is it possible to restrict the typ of the attachment in AGOL to image files, i.e. JPG or PDF files?
Not currently supported in the server side. This would need to be done on the client side.
However, you can create a view of the feature service / layer with restrictive access like viewing attachments only through feature service capabilities. You can allow editing of the attachments only in the source feature service.
Retrieving data ...