I am running PHP with Apache in your area on my small PC on Home windows.
The script uploads files towards the server.
Once the quality is larger than upload_max_filesize that's defined in php.ini or even the max_execution_time is exceeded, the file isn't submitted towards the server and that i aren't seeing any message error.
My real question is where I can tell that which was the mistake message that stopped the file from being submitted ?
Is the fact that easy to display a suitable message towards the user ?
I'd appreciate a code example. Thanks !

If you are searching to capture the mistake yourself, consider the set_error_handler function.

Check this out page: Error Messages Explained for info. In a nutshell, you will get file upload error messages from $_FILES['userfile']['error'] where 'userfile' may be the title from the form element.

Or simply print_r($_FILES); to determine all of the particulars from the current file upload.

A good example of exhibiting human-readable error messages towards the user may be:

switch($_FILES['userfile']['error'])
{
   case UPLOAD_ERR_INI_SIZE:
      echo 'The uploaded file exceeds the upload_max_filesize directive in php.ini.';
   break;
   case UPLOAD_ERR_CANT_WRITE:
      echo 'Failed to write file to disk.';
   break;
   // etc ...
}

max_execution_time isn't particularly personal files upload error. As troelskn remedied me (see his reply for more info), it is a fatal error and normally can not be caught in PHP, although Used to do find this other thread which references this post which presents a potential approach to catching fatal errors.

Also see the documentation for set_time_limit.

You can improve your php.ini server setting, or change that per application.

Server side setting: (modify your php.ini file and modify error_confirming to)

error_reporting = E_ALL & E_NOTICE & E_STRICT

For runtime setting: add the next towards the top of the application:

error_reporting(E_ALL & E_NOTICE & E_STRICT);

If your file surpasses upload_max_filesize, you will not really have an error elevated in PHP. The $_FILES array will just include these details.

max_execution_time boosts a fatal error, which means you can't catch it and display something nice towards the user. It will not usually happen throughout file upload, because it is the tame taken through the php script, which script will not start performing up until the file continues to be completely moved.

You can observe errors in Apache's general error-log.