From the course: PHP Techniques: Working with Files and Directories

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Sending files as form data

Sending files as form data - PHP Tutorial

From the course: PHP Techniques: Working with Files and Directories

Start my 1-month free trial

Sending files as form data

- [Instructor] In this movie, we'll learn how to create an HTML form which is appropriate for uploading files. This is going to be pure HTML. There's no PHP here. This is what a minimum form looks like. It starts with the form tag. It has an action. The page that the form will submit its data to, and then the form method is post because it will be a post request, and then notice that there's an attribute for something called ENC type, which is short for enclosure type. It's value is multipart/form-data. This parameter must be included in any form that's going to upload a file. You don't need it if you're not uploading a file, but if you're uploading a file, you do. It's part of the HTML specification. On the next line, I have an input tag of type file. It includes a name attribute. This is the name that we'll use to reference the uploaded data. You can have more than one of these on a form. You might have…

Contents