fileid vs __filename__

Hi, In the system$filedocument we see a "fileid" and a "filename" (note that it's two underscores "filename" two underscores, the format in the forum is removing the underscores when I add them). Usually the "fileid" and "filename" are the same value but ours have become out of sync. We aren't able to call "filename" through the API but only "fileid" and since they are out of sync, we are not able to grab the right file that we've uploaded. We've tried changing the "filename" number manually in the database to match "fileid" hoping that would correct the number count but the very next upload it goes back to the original count. The count went out of sync for us on a specific date back in May and since that date, has been consistently 4 off. We are not sure the exact cause at the moment. But does anyone know of a way we could correct the count so that they are back in sync?
1 answers

They don't have to be in sync. Files are normally retrieved by just the object identifier but you can fall back to fileid as well. The (hidden) field filename surrounded by underscores is just used internally to know what the file on disk is called, but it shouldn't matter for your use and is not something that is exposed. You should not change these things manually in your database though. I'm not sure how you are retrieving your files and which API you're using but the hidden field is never needed.