The first error is because you added this to the top of the page:
HTML comments need to be in the html... to do a php comment use:
<?php //Codigo_nuevo ?>
You also can't have blank lines before a redirect in php. So make sure to remove the blank lines on lines: 15,40 and 59 and update the other HTML comments above the <html> tag to use php comments instead.
I'd also remove the line:
The validation isn't working because you used the Binding for "file extension"... it is a bit confusing I know, but you should use "client file name". The validation looks for the "." before the extension to validate against and the "file extension" binding removes the ".".