Have you synchronized your database (from 3 to 4) on the same application server as where your files are? When converting from 3 to 4 there is a migration process for files that needs to be executed due to new object ids in 4.x
I'm not sure from your answer whether the migration/upgrade was done in the same location, or in a new directory structure - assuming the latter...
The files are stored on the server filesystem, normally in the <install location>\Application\Data\files or <install location>\Project\Data\files directory
You can simply copy these files from the old application directory to the new one. Alternatively, you can set the path to store files in the runtime configuration using the UploadedFilesPath custom setting to point to the old location.
I thought the migration was done on the same app server the files are on. The conversion was done some time ago, I don't want to/cannot roll this back.
Is there another way to migrate the files?
The files are in the right place, the files have a different number, though. For instance: the app tries to retrieve file with id 633 but there is no file with id 633. When I copy file 635 and rename it to 633, the file is retrieved, no problem.
How could this have happened? And, more important, is there a way to fix this?