Learn file uploads JavaScript and PHP Forms


show more Understanding file uploads provides you with in-depth training on Developer. Taught by Ray Villalobos as part of the Validating and Processing Forms with JavaScript and PHP show less
please wait ...

Understanding file uploads

So let's take a minute to talk about how file uploads work between forms and PHP. In addition to capturing regular text data, a form can also send a file into a folder on your server using PHP. In order for this to work, the form has to use the multipart/form-data enctype. This is part of your form tag. Because get methods are limited to the size that's allowed when sending data through a URL, you should use the post method if you're uploading files from a form. You can include the accept attribute inside the input field to limit the MIME type of the file you're uploading. If you have any questions about this make sure you check out the movie on Limiting Uploads by MIME Types.

When uploading files, you can use an optional hidden field with the name of Max File Size that PHP commands will try to recognize. So for example this input field tells PHP that this file should be no bigger than about 30K. One note, this hidden input field has to be placed before the ...

Understanding file uploads
Video duration: 3m 1s 2h 51m Intermediate

Viewers:

Understanding file uploads provides you with in-depth training on Developer. Taught by Ray Villalobos as part of the Validating and Processing Forms with JavaScript and PHP

Subjects:
Developer Web
Software:
JavaScript PHP
Author:
please wait ...