Get attachments
Retrieve a list of all files stored in the Media Library and attached to a particular post by given post ID.
To get attachments you have to specify existing post ID by using any pattern that holds post ID or with number. You can get all attached files or filter out them by using MIME type you need. You may choose from registered on your web site MIME types only.
Each element in the resulting list will contain information about one attached file.
For instance, to get a name of the first attached file use pattern: {PREVIOUS[0][post_title]}
, for a link to the file use {PREVIOUS[0][guid]}
, for the attachment ID use {PREVIOUS[0][ID]}
.
An additional file information available with keys file and size respectively: {PREVIOUS[0][file]}
and {PREVIOUS[0][size]}
.
If post doesn’t have attached files, the action will return false.
P.S. To iterate over a list use Iterate next action.