'An error occurred opening capture snapshot file."; } return; } else if( $command == UPDATE_SOFTWARE ) { ob_clean(); $status = new XMLStatus(); $tmp_name = $_FILES['softwareUpdate']['tmp_name']; error_log("is_uploaded_file tmp = ".$tmp_name); error_log("is_uploaded_file = ".$_FILES['softwareUpdate']['name']); $l = print_r($_FILES, TRUE); error_log($l); if (is_uploaded_file($_FILES['softwareUpdate']['tmp_name'])) { // Now lets verify that the file is good by running a "tar tzf" on it $sRet = system("tar tzf $tmp_name > /dev/null", $iRet); error_log("Call to system (tar) returned a \"$iRet\" and the output was \"$sRet\""); if ($iRet != 0) { error_log("Uploaded file was corrupt"); $status->setErrorCode("4112"); } else { $sRet = system("mkdir /home/embedded/library/upload", $iRet); error_log("Call to system (mkdir) returned a \"$iRet\" and the output was \"$sRet\""); error_log("The file has been uploaded. We are now going to move it to /home/embedded/library/upload"); if (move_uploaded_file($_FILES['softwareUpdate']['tmp_name'], "/home/embedded/library/upload/library.tgz")) { error_log("Moved the uploaded file to images"); error_log("The file tested good - The upload is complete and finished!!!"); reboot($user); print $status->out(); session_destroy(); unset( $_SESSION['login'] ); unset( $_SESSION['user'] ); unset( $_SESSION ); return; } else { error_log("Failed to moved the uploaded file to images"); $status->setErrorCode("4108"); } } print $status->out(); return; } else { if (is_null($_FILES["softwareUpdate"])) { error_log("The file is too big."); $status->setErrorCode("4109"); } else { switch ($HTTP_POST_FILES['softwareUpdate']['error']) { case 1 : //uploaded file exceeds the upload_max_filesize directive in php.ini case 2 : //uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form error_log("The file you are trying to upload is too big."); $status->setErrorCode("4109"); break; case 3 : //uploaded file was only partially uploaded error_log("The file you are trying upload was only partially uploaded."); $status->setErrorCode("4110"); break; case 4 : //no file was uploaded error_log("You must select an image for upload."); $status->setErrorCode("4111"); break; default : //a default error, just in case! :) error_log("There was a problem with your upload."); $status->setErrorCode("4108"); break; } } } print $status->out(); return; } else if( $command == LOGOFF_CMD ) { header("Location:".LOGOFF_PAGE); } } ?> Ilink Menu