class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
Is it possible to overwrite an error produced by the script? For example, If i wanted to limit the upload size using:
$handle->file_max_size = "2097152";
This would produce the error "File too big", or whatever was in the translation etc. If I wanted to catch this error, and overwrite it, perhaps with some more detail, e.g. file size, limit size and file name.
Is there an easy way to do this, or is it best to amend the main class script to return all of the required information?
2. Catch the error message if processed is false. If the error message returned by the class is equal to "File too big" (or the translated version), you can rewrite it, and complete it using the values file_src_size, file_max_size and file_src_nameReply
Is it possible to overwrite an error produced by the script? For example, If i wanted to limit the upload size using:
This would produce the error "File too big", or whatever was in the translation etc. If I wanted to catch this error, and overwrite it, perhaps with some more detail, e.g. file size, limit size and file name.
Is there an easy way to do this, or is it best to amend the main class script to return all of the required information?
Best regards, Ben.
1. You can edit the class, and change the error message, using file_src_size, file_max_size and file_src_name. Do this here:
2. Catch the error message if processed is false. If the error message returned by the class is equal to "File too big" (or the translated version), you can rewrite it, and complete it using the values file_src_size, file_max_size and file_src_name
Many thanks, Ben.