Selaa lähdekoodia

注销文件操作

guanhailong 2 vuotta sitten
vanhempi
commit
1297da60a9
1 muutettua tiedostoa jossa 7 lisäystä ja 7 poistoa
  1. 7 7
      AdminController/VersionManagementController.py

+ 7 - 7
AdminController/VersionManagementController.py

@@ -104,7 +104,7 @@ class VersionManagement(View):
             return response.json(500, repr(e))
             return response.json(500, repr(e))
 
 
     def upLoadFile(self, request, request_dict, response):
     def upLoadFile(self, request, request_dict, response):
-        file = request.FILES.get('file', None)
+        # file = request.FILES.get('file', None)
         mci = request_dict.get('mci', '')
         mci = request_dict.get('mci', '')
         lang = request_dict.get('lang', '')
         lang = request_dict.get('lang', '')
         ESN = request_dict.get('ESN', '')
         ESN = request_dict.get('ESN', '')
@@ -114,7 +114,7 @@ class VersionManagement(View):
         Description = request_dict.get('Description', '')
         Description = request_dict.get('Description', '')
         status = request_dict.get('status', 0)
         status = request_dict.get('status', 0)
 
 
-        if not all([file, mci, lang, ESN, max_ver, channel, resolutionRatio]):
+        if not all([mci, lang, ESN, max_ver, channel, resolutionRatio]):
             return response.json(444)
             return response.json(444)
 
 
         try:
         try:
@@ -164,11 +164,11 @@ class VersionManagement(View):
                 os.makedirs(upload_path)
                 os.makedirs(upload_path)
             # 文件上传
             # 文件上传
             full_name = upload_path + file_name
             full_name = upload_path + file_name
-            if os.path.exists(full_name):  # 删除同名文件
-                os.remove(full_name)
-            with open(full_name, 'wb+') as write_file:
-                for chunk in file.chunks():
-                    write_file.write(chunk)
+            # if os.path.exists(full_name):  # 删除同名文件
+            #     os.remove(full_name)
+            # with open(full_name, 'wb+') as write_file:
+            #     for chunk in file.chunks():
+            #         write_file.write(chunk)
             return response.json(0)
             return response.json(0)
         except Exception as e:
         except Exception as e:
             print(e)
             print(e)