How to get the filename in the upload folder for a custom image field

Ok, let me start saying that I really searched for something helpful in the forums, maybe I wasn’t using the correct method, but i found nothing about this.
Like the title says I need to get the filenames for the images stored in the upload folder for a custom image field, in the database the field shows the original name of the file but in the upload folder there are a lot o files without extension. So i guess there’s a table where that relation exists or there is a php function that changes myImage.jpg to bbb3243211-123123b21312 but i don’t know where is it. I need to use those images related to that field in another application so i’m querying the database. Plaease Help.

Look at the notes and documents tables.

Notice that the id field in the notes tables corresponds the filename in the uploads folder.

Notice that the document_revision_id in the documents table also refers to the filename in the uploads folder.

Each module has a modulename_cstm table for custom fields. When you add a custom image field to a module It will create a id_c and fieldname_c. The id_c is the same filename in the uploads folder. The fieldname_c is the original file name.

The include/upload_file.php or include/UploadFile.php in newer versions … handles this behaviour. This class is referred to by the various modules which handle files.


I have a few articles on my blog about “How are [module] stored in the database”,

they are all quite similar because like Daniel wrote UploadFile handles uploads for more than one module. Some of those articles have sample SQL statements you can use.


Wow it was so simple, Thank you both very much you helped me a lot