Uploading/attaching files

I have a form. There’s a button to let a user browse and attach a file.

How do I get the php or whatever server side script I need to actually attach that file? Or is something else involved?

I don’t know how to let someone attach a word/pdf etc file to a form and then email the contents with the attachment.

thanks for the insight.