Displaying the server limits


show more Displaying 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 ...

Displaying the server limits

To make the file upload form more user-friendly, it's a good idea to display the server limits in the web page. You can do this by checking the server configuration, and then hard coding the values into the page. But actually, we've got all the tools necessary to get the values dynamically. Rather than querying the server each time the page loads, let's store the values as session variables. So, we'll need to initialize a session, and then we need to check if one of the session variables is being set.

We only need to check one because if one hasn't been set, none of them will have been. So, if and not isset, and what we're looking for is SESSION. And we'll look for maxfiles. If that doesn't exist, we need to create it by querying the server configuration and getting the value of max_file_uploads. So, SESSION maxfiles, and then we can use ini_get and it's the max_file_uploads that we are looking for. Then another SESSION variable, call this one postmax.

And we'll u...

Displaying the server limits
Video duration: 4m 51s 2h 50m Intermediate

Viewers:

Displaying 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 ...