Alerting the user about exceeding the server limits


show more Alerting the user about exceeding the server limits provides you with in-depth training on Developer. Taught by David Powers as part of the Uploading Files Securely with PHP show less
please wait ...

Alerting the user about exceeding the server limits

PHP runs on the web server. So it can't do very much to prevent users from submitting a form that attempts to upload files in excess of the server limits. Its sole protection within the browser is the Max_File_Size hidden field, which you can see here on line 52 of form.php. It sets the size limit for individual files. But there are no checks on the number of files nor on their combined size until the data is received by the server.

However, by combining PHP with JavaScript, there is something you can do to alert the user to potential problems. We've already stored the server limits in session variables. Let's go up to the top of the page to see that, we've got Session maxfiles, Session postmax and Session displaymax. These kept the maximum number of simultaneous uploads, the maximum combined size, both in bytes and in a user friendly version.

So what we're going to do, is to create some custom attributes inside the file input field to store these values. So let's go back down t...

Alerting the user about exceeding the server limits
Video duration: 6m 14s 2h 50m Intermediate

Viewers:

Alerting the user about exceeding the server limits provides you with in-depth training on Developer. Taught by David Powers as part of the Uploading Files Securely with PHP

Subject:
Developer
Software:
PHP
Author:
please wait ...