How to code a conditional required for a user input

I have a user input form with a submit button. I want the users to be required to upload either a document or image. Being that I cant have one button that accepts both formats, I put 2 buttons, one that accepts images and one that accepts documents. But how can I make a conditional that if one is empty then the other is required?
Thank You!