Can't actually require FILENAME or REMOTE_FILENAME because I don't know if you're going to upload or download. However, there shouldn't be a stacktrace when you just try to go with neither.
See #5291. Just renaming the file.