Role of user who added file

I have a files field, and an associated template for files uploaded using it. I would like to include the role of the user who added a file to the template (e.g. admin, editor), is this possible? Ideally I don’t want this to be adjustable by the editor using the field.

You can add a users field to the file blueprint. The current user will then automatically be filled in at file upload.

To prevent editing of the field, you can disable it, so that it’s only readable.

Oops, I didn’t read closely. What I suggested gives you the user, not the role. But of course, you can get the role from the user.

However, if you wanted to add the role only rather than the user, you would have to use a file.create:after hook to add this information.