0

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?

3
  1. You can find fid under the table name file_managed.
  2. It is unique id for files. In files you can include images, .txt, .pdf etc extension files.
  3. This fid is unique for the site and auto incremented
  4. 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.

  • It's ., not ), if you want to have properly formatted list here. – Mołot Jan 7 '16 at 13:19
  • 1
    Sorry to downvote, but you've got to at least get the name of the table right... – Clive Jan 7 '16 at 13:25
  • Clive and Molot are right. I suggested an edit to add their observation. Adding these correction, the answer seems complete to me :) Thank you all – Sasha Grievus Jan 7 '16 at 13:34
2

Once file gets uploaded it stores the record to Database. The fid is file ID of the uploaded file.

Refer file_load

  • oh, so it is only the incremental id given to the record of the file! Thank you very much – Sasha Grievus Jan 7 '16 at 12:54
  • 2
    It's only valid for managed files. Files uploaded as unmanaged does not have records in database, please make it clear in your answer. – Mołot Jan 7 '16 at 13:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.