Thinking about implementation, I think it could be kept pretty simple. If you check the box, the posts have to have at least one attachment. If you don't check the box, it doesn't matter if the post has any attachments or not. Of course, you could go further and allow searching for posts the do not have any attachments, or even search for number of attachments, file type, file name, etc, but I think all of that would be unnecessary. Just one simple checkbox-- "Search posts with attachment(s) only".