What is FID and how does it works? I could not find a clear explanation about what is a 'fid'. I got is an identifier for file in drupal, but no more than that. How it is generated? Is unique for any file? When it is used and why? Could someone give a clear explanation of this entity?
You can find fid under the table name file_managed.
It is unique id for files. In files you can include images, .txt, .pdf etc extension files.
This fid is unique for the site and auto incremented
By using file_load($fid) function. Where $fid is file id.


Fid is only valid for managed files. Files uploaded as unmanaged does not have records in database, so no fid.