Log in

View Full Version : Listing all attachment from a thread


TitanKing
06-02-2005, 01:18 PM
Heya all, I found that VB uses a rather complicated method of storing attachments, not that I mind its just complicated to retrieve those attachments from an external script... can anyone perhaps point me in the right direction regarding the retrievel query, its kinda confusing... I would appreciate it very much people.

Thank you in advance...

Andreas
06-02-2005, 01:49 PM
Uh? I thought attachments are pretty simple ...

Basically all you need is in table attachment
attachmentid = Unique identifier for each attachment
userid = The userid of the attachments owner
dateline = UNIX timestamp wehn the attachment was added
filename = The filename
filedata = The file contents (if stored in the database)
visible = 1 = Normal, 0 = In moderation queue
counter = Download-Counter
postid = ID of the post where this attachment is located
filesize = The filesize in Bytes
thumbnail = The thumbnail, if enabled and the attachment is an image and attachments are being stored in the database
filehash = MD5 hash of the file contents
posthash = MD5 hash of the associated post
thumbnail_dateline = UNIX timestamp of the thumbnail
thumbnail_size = Filesize of the thumbnail

If you are storing attachments als files, they are located at /attachpath/u/s/e/r/i/d as attachmentid.attach (the file) and attachmentid.thumb (the thumbnail).

Is that enough info to get you started?

If you want to get information about all attachments in thread 1234
SELECT attachmentid, userid, dateline, filename, visible, counter, postid, filesize, filehash, posthash, thumbnail_dateline, thumbnail_size FROM attachment WHERE threaid = 1234

TitanKing
06-02-2005, 01:53 PM
Thank you very much KirbyDE this will surely set me on the right track, I appreciate your reply so much...