you can make the file field mandatory using the Server Validations included in CSS Form Builder.
Use the required not blank validation type. click the lightning bolt next to server variable and select the File Field File Name variable from the form collection in the binding panel.
Hiding the output of that code is not going to help us troubleshoot the issue.
If it is a live page, i would suggest saving a copy of it that can be used for troubleshooting, and not including that code on the live copy.
you will need to make sure to change the forms action in the copy you create for troubleshooting so it will post to the correct page.
I need to see the output of that code _After_ trying an upload that fails, that will help me to determine what is going wrong with the file upload.