Index: /branches/rel_apv_10_7/usr/click/webui/htdocs/new/src/apv/models/system/__init__.py
===================================================================
--- /branches/rel_apv_10_7/usr/click/webui/htdocs/new/src/apv/models/system/__init__.py	(revision 39221)
+++ /branches/rel_apv_10_7/usr/click/webui/htdocs/new/src/apv/models/system/__init__.py	(working copy)
@@ -2,13 +2,14 @@
 from hive.model.manager import ANManager
 from django.utils.translation import ugettext_lazy as _
 import random
-from hive.utils import get_current_session, local_equirement
+from hive.utils import get_current_session, local_equirement, remove_files_by_dir
 from apv.company import *
 import re
 from django.utils.importlib import import_module
 from hive.utils import get_sysctl_int, dict_combine, andebug
 import subprocess, threading
 from djproject.an_settings import FAST_CLI_CMD, CONFIG_FILE, LOGIN_USER_PATH
+from djproject.settings import FILE_UPLOAD_DIR
 __=_
 import os
 from time import time
@@ -428,16 +429,20 @@
         btn_class = 'btn-danger slow-action'
         process_title = "System Rebooting..."
         forever = False
-          
+
+    class CheckFiles(Action):
+        btn_class = 'hidden'
+        forever = False
+
     class Meta:
         profile = True
         verbose_name = _('System Update')
         show_im_export_button = False
-    
+
     class Manager(CLIManager):
         def _get_query_set(self):
             return QuerySet(self._model, [{}])
-        
+
         def _perform_Update(self, options):
             andebug('hive.debug', 'system update...')
             if options["partition"] == "default":
@@ -460,10 +465,16 @@
             result = self.cli.cmd_pipe('system patch rollback\nYES\n')
             return result
 
+        def _perform_CheckFiles(self):
+            result = remove_files_by_dir(FILE_UPLOAD_DIR, False, False)
+            if not result:
+                andebug("hive.debug", "There is issue occurred when removing old files: %s" % result)
+            return result
+
 class WebUISourceIP(ANModel):
     ip = IPAddressField(verbose_name='Source IP', primary_key=True)
     netmask_prefix = UnionField(verbose_name=_('Netmask/Prefix'), primary_key=True, fields={
-        'netmask':NetmaskField(verbose_name=_('Netmask')), 
+        'netmask':NetmaskField(verbose_name=_('Netmask')),
         'prefix':NetprefixField(verbose_name=_('Prefix'))})
     action = EnumField(verbose_name=_('Action'), default='permit',values=(
                             ('permit', 'PERMIT'),
Index: /branches/rel_apv_10_7/usr/click/webui/htdocs/new/src/apv/templates/system/SystemUpdate/box_instance_action.html
===================================================================
--- /branches/rel_apv_10_7/usr/click/webui/htdocs/new/src/apv/templates/system/SystemUpdate/box_instance_action.html	(revision 39221)
+++ /branches/rel_apv_10_7/usr/click/webui/htdocs/new/src/apv/templates/system/SystemUpdate/box_instance_action.html	(working copy)
@@ -83,6 +83,20 @@
 // Just make editor happy to highlight the scripts
 {% endif %}
 
+$.ajax({
+    url: '/api/apv/system/SystemUpdate/_perform?action=CheckFiles',
+    type: 'POST',
+    dataType: "json",
+    data: {
+        options: JSON.stringify({})
+    },
+    success: function(res) {
+        if (!res[0]) {
+            console.log(res);
+        }
+    }
+});
+
 {% for action in MODEL._meta.explicit_actions %}
 require(['widget-form', 'hive'], function(form){
     var hook = js_hook_{{ id|jsvar }}_{{ action.name }};
Index: /branches/rel_apv_10_7/usr/click/webui/htdocs/new/src/hive/utils.py
===================================================================
--- /branches/rel_apv_10_7/usr/click/webui/htdocs/new/src/hive/utils.py	(revision 39221)
+++ /branches/rel_apv_10_7/usr/click/webui/htdocs/new/src/hive/utils.py	(working copy)
@@ -23,7 +23,8 @@
 import commands
 import cgi
 import djproject.an_settings
-    
+import shutil
+
 def get_current_request():
     return getattr(_thread_locals, 'request', None)
 
@@ -1387,3 +1388,24 @@
         return ','.join(matched_illegal_character_list)
     else:
         return
+
+def remove_files_by_dir(path_of_dir, is_unlink, is_recursive):
+    """
+    It will remove or unlink files in the directory
+    :param string path_of_dir path of the directory
+    :param boolean is_unlink if True will also unlink files in the directory
+    :param boolean is_recur if True will also remove the directories
+    """
+    result = ""
+    for filename in os.listdir(path_of_dir):
+        file_path = os.path.join(path_of_dir, filename)
+        try:
+            if os.path.islink(file_path) and is_unlink:
+                os.unlink(file_path)
+            elif os.path.isfile(file_path):
+                os.unlink(file_path)
+            elif os.path.isdir(file_path) and is_recursive:
+                shutil.rmtree(file_path)
+        except Exception as e:
+            result = 'Failed to delete %s. Reason: %s' % (file_path, e)
+    return result
