View Full Version : vBulletin attachments table structure
Abubaker87
02-11-2015, 06:54 PM
I am importing posts from a custom forum to vBulletin 4. I have done most of the work. Now only photos/videos needs to be copied.
For that I will replace [img] tags (old Forum tags) to vBulletin tags such as ID. But I need to know how does vB manages attachments? What is the table structure? Which tables are involved?
So far I have found that following tables are involved
filedata
attachmentcategoryuser
attachment
AusPhotography
02-11-2015, 07:12 PM
It also depends on storing attachments in the database (Bad) or the file system (Good)
I.e. the file system comes into play
To import the image has to be local to the vB system - if IMG tags were used then they need to stay that way as the image is likely to not be on your server
I don't know all the details, but basically each file has a row in filedata. If you are storing files in the database, then the actual file contents go in there, otherwise they go in the filesystem, and I believe the filename is related to the fileid. Then there's a row in attachment for each place it's attached (the same file can be attached more than one place). contenttype tells what it's attached to (a post or somewhere else, I'm no sure what all the possibilities are), and contentid has the postid or whateevr other id is appropriate. Also, in the post table I believe the attach column is the count of attachments to each post.
I don't know what attachmentcategoryuser is for.
Sorry I don't have more details off the top of my head, maybe someone else will have more to say.
Abubaker87
02-11-2015, 07:24 PM
Thank you both. I have an external PHP external that gets the image from URL and create records in the 3 tables I mentioned. However, I am not creating posthash column. Then I am replacing [img] tags with [ATTACH=CONFIG] tags so that VBulletin can understand that it is an attachment. But attachments are not being shown as photos. THere is only a link shown in the posts.
Attachment are stored in DB in my VB forum. I read it that database is a better option because of performance.
AusPhotography
02-11-2015, 07:24 PM
On the file system the path to the files is based on the userid then the attachment id as the file.
Eg for me the path would be ./attachments/2/2/8/7/8/1/123.attach and also .thumb depending of where you setup the attachments folder.
The attachment renderer handles the file types
Abubaker87
02-11-2015, 07:31 PM
I am stuck as to how Can i get the photos in the post from custom forums to vB Forums.
--------------- Added 1423690944 at 1423690944 ---------------
Need help from vB experts!!
AusPhotography
02-11-2015, 07:55 PM
Best is to download impex (free on GitHUB) and look at the import code and adapt that.
See https://members.vbulletin.com/import.php
Did you include the thumbnail info? If not you might try Maintenance > General Update Tools > Rebuild Attachment Thumbnails.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.