summaryrefslogtreecommitdiffstats
path: root/usr/local/www/system_firmware.php
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2009-07-04 16:07:16 -0400
committerScott Ullrich <sullrich@pfsense.org>2009-07-04 16:07:16 -0400
commitcdd3238d3b4f4e8e853ba221b804e21b69be2ac8 (patch)
tree4701b2f990e4744f1669e1ab9db4ac7b05cc2d21 /usr/local/www/system_firmware.php
parent144420334464acd2d12f06bc1693fa3f9aa5086f (diff)
downloadpfsense-cdd3238d3b4f4e8e853ba221b804e21b69be2ac8.zip
pfsense-cdd3238d3b4f4e8e853ba221b804e21b69be2ac8.tar.gz
Add function to explain the error code
Diffstat (limited to 'usr/local/www/system_firmware.php')
-rwxr-xr-xusr/local/www/system_firmware.php27
1 files changed, 23 insertions, 4 deletions
diff --git a/usr/local/www/system_firmware.php b/usr/local/www/system_firmware.php
index 8b7a95c..4e87266 100755
--- a/usr/local/www/system_firmware.php
+++ b/usr/local/www/system_firmware.php
@@ -49,6 +49,27 @@ require_once("xmlrpc_client.inc");
ini_set('max_execution_time', '9999');
ini_set('max_input_time', '9999');
+function file_upload_error_message($error_code) {
+ switch ($error_code) {
+ case UPLOAD_ERR_INI_SIZE:
+ return 'The uploaded file exceeds the upload_max_filesize directive in php.ini';
+ case UPLOAD_ERR_FORM_SIZE:
+ return 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form';
+ case UPLOAD_ERR_PARTIAL:
+ return 'The uploaded file was only partially uploaded';
+ case UPLOAD_ERR_NO_FILE:
+ return 'No file was uploaded';
+ case UPLOAD_ERR_NO_TMP_DIR:
+ return 'Missing a temporary folder';
+ case UPLOAD_ERR_CANT_WRITE:
+ return 'Failed to write file to disk';
+ case UPLOAD_ERR_EXTENSION:
+ return 'File upload stopped by extension';
+ default:
+ return 'Unknown upload error';
+ }
+}
+
/* if upgrade in progress, alert user */
if(is_subsystem_dirty('firmwarelock')) {
$pgtitle = array("System","Firmware","Manual Update");
@@ -89,16 +110,14 @@ if ($_POST && !is_subsystem_dirty('firmwarelock')) {
}
if ($mode) {
if ($mode == "enable") {
- mwexec("/etc/rc.firmware enable");
conf_mount_rw();
mark_subsystem_dirty('firmware');
} else if ($mode == "disable") {
- mwexec("/etc/rc.firmware disable");
conf_mount_ro();
clear_subsystem_dirty('firmware');
} else if ($mode == "upgrade") {
- if($_FILES['ulfile']['error'])
- $errortext = "Error ({$_FILES['ulfile']['error']})";
+ if ($_FILES['ulfile']['error'])
+ $errortext = "(" . file_upload_error_message($_FILES['ulfile']['error']) . ")";
if (is_uploaded_file($_FILES['ulfile']['tmp_name'])) {
/* verify firmware image(s) */
if (!stristr($_FILES['ulfile']['name'], $g['platform']) && !$_POST['sig_override'])
OpenPOWER on IntegriCloud