using php's native mail
function, this is doable but very hard.
You would need to implement mail's multipart protocol yourself (requires to specify additional headers and encoding your attachment in the body).
Here's an example of how a multipart mail looks (taken from the RFC)
From: Nathaniel Borenstein <nsb@bellcore.com>
To: Ned Freed <ned@innosoft.com>
Subject: Sample message
MIME-Version: 1.0
Content-type: multipart/mixed; boundary="simple
boundary"
This is the preamble. It is to be ignored, though it
is a handy place for mail composers to include an
explanatory note to non-MIME compliant readers.
--simple boundary
This is implicitly typed plain ASCII text.
It does NOT end with a linebreak.
--simple boundary
Content-type: text/plain; charset=us-ascii
This is explicitly typed plain ASCII text.
It DOES end with a linebreak.
--simple boundary--
This is the epilogue. It is also to be ignored.
what this means, is that you would first need to pass a specific Content-Type header to the mail, where the boundary value specifies seperators between all parts in the mail (normally you would have two parts: your mail's actual content and the attachment).
Then in the mail body, you would need to have a string containing all these parts as shown in the example above.
In case you wanted to attach binary files, things would be even more complicated, because then you would probably need to base64 encode these binary images and add the used encoding to the part's header that was encoded.
To sum up: if you want attachments, don't use the php mail
function for that, but rather use tools like PHPMailer, which will be more high level and simpler to use.