Error when uploading a file in shiny application

Most of the time when uploading a text file in my shiny application, there is no problem. But occasionally, I get the error <!DOCTYPE HTML><html lang="en"><head>, and the file won't upload. If I try it locally on my own computer, the same file uploads without any problems.

I tried to narrow it down by using one of the files that gives me the error by breaking it up and see if the pieces upload. I was able to cut down the file to a very small size and still get the error. However, changing one more line in that file, for example, removing one of the empty lines in the file, will change it sufficiently so that it uploads without problem.

How can I get around this problem?