HomePHP Page 2 - Building A PHP-Based Mail Client (part 3)
Composing Yourself - PHP
This third (and final) segment of our case study discusses theprocess of sending MIME-encoded email, demonstrating how to compose,forward and reply to email through a Web browser. It also discusses, indetail, the process of constructing a MIME-encoded message withattachments, explains PHP's HTTP upload capabilities, and examines thestandard error handler used throughout this case study.
There are a couple of things to be noted here. First, the
<input type="file" name="attachment" size="20">
construct near the end of the form. This form construct
creates a "Browse..." button on the form, which allows for file selection and upload through the browser; I plan to allow the user to upload message attachments though this construct.
Second, note the form encoding type and method:
<form action="send.php" method="post" enctype="multipart/form-data">
<!-- snipped out HTML -->
This encoding type and method must be specified whenever you
attempt file upload over HTTP. PHP's official site has a manual page devoted to the topic - take a look at http://download.php.net/manual/en/features.file-upload.php and then come back for more.