Files posted to WordPress from the post edit screen are referred to as attachments. When you use the Add Media button on the post edit screen to upload a file, it automatically becomes an attachment to that post. Directly uploaded files to the Media Library aren’t necessarily associated with a post or page. Any file that may be uploaded utilizing the media upload can be considered an attachment.
The attachment feature can be used by theme developers to change the appearance of posts with attachments by using template tags and conditional template tags. The use of Post Image is a frequent example of developers using attachments with posts; these images can be set to a default, a category image, or a new image for each post (which could be a attachment of that post displayed in the particular way that the theme is setup to display it).
After uploading media to the media library, the Media Library sub panel can be used to attach media to specific posts. Any media that is posted or referenced in a single post is immediately connected to that post. When posts are deleted from WordPress, media that was previously associated to them may become unattached. These media can be reattached to a new post in the same way they were attached to the previous one. Media can be be attached to numerous posts at once and then detached from any of them if necessary.