I know this has been asked before but so far I haven't found anyone who has been able to answer this question. What Magic Trick does WordPress use to store the Media Files in the Library? Just putting files in the upload directory does not work. I can't find a single link to the files in the database so how is it getting its information?
I see people pointing to a plugin to pull files that are already on the server into the media library but no one has said where the information is stored. Surely somebody knows this information, they programed it. Why the big secret? Is it stored as a compressed array in the table? Those things are so hard to debug and look at.