Unique uploads from two single file uniform fields

I have a form on the front-end with two separate file upload fields each accepting one jpg each. Both are required but if you pick the same image twice the form still uploads. Ideally, I’d like a validation option to check if each image is unique or has the same name but having trouble getting my head around how to do this using uniform.

I need to use 2 single image fields rather than one field that accepts multiple images as I found users don’t necessarily always understand you can upload multiple images with the file picker and two distinct labelled fields is just clearer.

Seán

Maybe as a first step it would make sense to do this on the frontend via JavaScript before the files are even sent to the server, and then additionally on the server side as a second step. I don’t really know how to validate this on using uniform, but you can certainly evaluate $_FILE.

Thanks texnixe. I did this on the frontend as you advised which maybe is sufficient for my needs here. If someone magically manages to bypass that, I can look into how it could be handled on the server side.