That's because you're converting the filename to upper case rather than the data inside the file.

Read the text in from the file first, then convert it to upper case and write it back out.

To...