Manually adding attachments and images via PHP script?

Dannymh

Active member
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
 
You would have to dig into the code and check how it's done when uploading an attachment to a post, then replicate that.
 
You would have to dig into the code and check how it's done when uploading an attachment to a post, then replicate that.

Thanks Brogan, however I'm looking at the attachmenthandler folder and don't know where to start!
 
You should look into:
XenForo_ControllerPublic_Attachment::actionDoUpload()
XenForo_Model_Attachment
XenForo_DataWriter_Attachment
XenForo_DataWriter_AttachmentData
 
If there are any developers who would like to build me a script as a paid job please let me know.

Thanks
Andy
 
Back
Top Bottom