April 2026
Intermediate
1009 pages
34h 15m
English
One type of form field has not yet been mentioned: <input type="file" />. This is a field for uploading files, which allows a user to transfer files to the web server via a web browser. One application for this is webmail scripts, which make it possible to attach files to an email (see Figure 13.11 and Figure 13.12).
PHP offers a simple integrated option for accessing such file uploads. First, you need to adapt the form: If the enctype attribute of the form is not set as shown, you cannot access the transferred data on the server side. You must also send the form via POST. To be honest, it would also make little sense to rely on the GET restrictions for files:
<form method="post" enctype="multipart/form-data">
All you need ...
Read now
Unlock full access