PDA

View Full Version : Attachment Type


Forum-Germany
11-08-2014, 01:45 AM
Hello.

How can I distinguish as "images" or other types of attachments using the database?

The column "contenttypeid" it can not be, since JPG images sometimes have the ID "1" but also "24". RAR files have "1"...

I need a differentiator.

Thanks.

kh99
11-08-2014, 10:11 AM
It think what you want is to use the filedataid and the filedata table, then look at the 'extension' column.

Forum-Germany
11-08-2014, 03:07 PM
Thanks.

Table filedate: 225 Results
Table attachments: 274 Results

ACP -> Attachments... 274 / 225

He?

kh99
11-08-2014, 03:46 PM
Are you asking why there are more attachments than filedata? I'm not sure, but I think it's probably because you can attach the same file more than once, so if you attached the same file to 2 different posts then there would be 2 rows in the attachment table with the same filedataid.

Forum-Germany
11-08-2014, 08:51 PM
You are right. :up:


"SELECT DISTINCT filedataid FROM attachment"


Result: 224

:) :up: