Forums

How does uploads work? (6 posts)

  1. carlla
    Member
    Posted 2 years ago #

    Does anyone know if a new attachment is only a new wp_post record?

    I am trying to do an automatic upload engine. But my images isn't opening like the other normal attachments. I can access normal wp attachments by "pagename/imagename". But this structure seems not work for automatic attachments. Every new image is being redirects to 404.

    So I decided to ask it on forum to understand the proccess to create a new attachment.

  2. MichaelH
    Volunteer
    Posted 2 years ago #

    Not much help here but to maybe show you a plugin that might help understand:

    http://wordpress.org/extend/plugins/add-from-server/

  3. carlla
    Member
    Posted 2 years ago #

    Thank you very much for your help =)

    I tested it and that is what happens:
    When we upload an image through add-from-server tab, the new image is attached to the page and the image appears on gallery tab.
    Looking at the new attachment entry on wp_posts table I noticed that post_parent field was setted to the page's id I am editing. But I still can't access the image through pagename/imagename permalink.

    Whether I insert this new image on page I can access the image through pagename/imagename.

    So what I find is:
    A new wp_post entry isn't enough to create a new attachment, and the page_parent field value isn't enought to WP find the image through the post permalink.

    So, what else happens when an image is attached to a post?
    - upload file to server
    - new post entry where post_type is 'attachment' and post_parent is page's id which we are editing
    - ? (what else?)

    I still looking for a way to create a permalink to access my images. Any help is very appreciated. =)

  4. carlla
    Member
    Posted 2 years ago #

    It's not making any sense for me.. can anyone help?

    Once a wp_post entry looks like another one (only changing the fields id and post_name), what can take WP find an attachment by name (domain.com/pagename/imagename), but not the other one?

  5. carlla
    Member
    Posted 2 years ago #

    @MichaelH: Do you know why an image listed in gallery tab (when editing a page), but not inserted yet, cannot be accessed by a permalink but another image which had already been inserted on this same page can be access by a permalink?

    I mean, what does WP check before load the image.php? What is the diference on database between those two images?

  6. carlla
    Member
    Posted 2 years ago #

    Nobody knows answer me? =( really?

    Where else can I get some help with it?

Topic Closed

This topic has been closed to new replies.

About this Topic