Unfortunately, this is not possible on the fly, because your second field knows nothing of the first before the page is saved.
You would need a custom solution here, i.e. a field that listens to changing values of the first field. Or maybe a combination of two fields in one.
See also: Programmatically change the content of the file field - #38 by bastianallgeier