Learn how to handle multiple file uploads in PHP. You’ll also learn how to select directories (instead of files) with the directory picker attribute and upload the directories content to the server. You’ll also use the new feature “full_path” (as of PHP 8.1), a subkey of $_FILES array to create the exact directory structure of uploaded directories.
Category: PHP
PHP is a scripting language that’s usually embedded or combined with HTML and has many excellent libraries that provide fast, customized access to DBMSs.
Renaming and Sanitizing Uploaded File Name
In this tutorial, you’ll create functions to automatically rename the uploaded file name, generate a unique file name based on the Unix timestamp, and remove special characters to sanitize the file name.
Learn how to check the file extension and MIME type of the uploaded (or any) file in PHP.
Handling File Uploads
Learn how to upload files through an HTML form and save them somewhere on the server.
Form Validation
Form validation is one of the most important parts of a website, in this tutorial you’ll learn how to validate a form and how to display error messages with the form.
Preselecting Multiple Selection Lists
Learn how to use the <select>, <optgroup>, and <option> tags to create a single or multiple selection dropdown list. You’ll also learn how to use the “selected” attribute to preselect options in the select tag.
Preselecting Check Boxes
Let’s see how to return checked (or selected) checkboxes upon submitting a form. You’ll learn how to process individual or group (array) checkboxes with PHP.
Preselecting Radio Buttons
When submitting a form to the server, the value of the selected radio button is passed to the server. Compare that value, if it fits, print out “checked” to preselect that radio button.
Prefilling Text Fields
Learn how to fill fields with the submitted data. For example, when the password is wrong or the username is already taken. You’ll also learn techniques to prefill form by retrieving data from cookies that you saved in cookies on successful submission of the form.
Using Form Elements
Form elements are used for capturing user input. A form contains one or more elements, which are the fields where the user can enter data. When a user finishes entering the data, the form is submitted to the server for verification or storing of the data.