• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Manually adding attachments and images via PHP script?

Dannymh

Active member
#1
Hi All,

I am writing a PHP script to import my wordpress data. I can import all of the content fine but am having real issues importing my images with these posts.

I can get the attachment to a thread by inserting the correct data, however if I click on the image it comes up with a xenforo error.

Is there a way or simple class that I can use to attach images to posts from an external PHP script

Dan
 

Brogan

XenForo moderator
Staff member
#3
You would have to dig into the code and check how it's done when uploading an attachment to a post, then replicate that.
 

Mr. Goodie2Shoes

Well-known member
#5
You should look into:
XenForo_ControllerPublic_Attachment::actionDoUpload()
XenForo_Model_Attachment
XenForo_DataWriter_Attachment
XenForo_DataWriter_AttachmentData