1. 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?

Discussion in 'General PHP and MySQL Discussions' started by Dannymh, Dec 1, 2014.

  1. Dannymh

    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
     
    Cooper likes this.
  2. Cooper

    Cooper Active Member

    I'd like to know this as well :)
     
  3. Brogan

    Brogan XenForo Moderator Staff Member

    You would have to dig into the code and check how it's done when uploading an attachment to a post, then replicate that.
     
  4. Cooper

    Cooper Active Member

    Thanks Brogan, however I'm looking at the attachmenthandler folder and don't know where to start!
     
  5. Mr. Goodie2Shoes

    Mr. Goodie2Shoes Well-Known Member

    You should look into:
    XenForo_ControllerPublic_Attachment::actionDoUpload()
    XenForo_Model_Attachment
    XenForo_DataWriter_Attachment
    XenForo_DataWriter_AttachmentData
     
    Cooper likes this.
  6. Cooper

    Cooper Active Member

    Thanks, think I need some developer help on this one.
     
  7. Cooper

    Cooper Active Member

    If there are any developers who would like to build me a script as a paid job please let me know.

    Thanks
    Andy
     

Share This Page