Эх сурвалжийг харах

[importer_direct_upload_size] putting the limit (200KB) on size of file uploaded

ayush.goyal 4 жил өмнө
parent
commit
caa210a1c3

+ 16 - 11
desktop/libs/indexer/src/indexer/templates/importer.mako

@@ -3185,17 +3185,22 @@ ${ commonheader(_("Importer"), "indexer", user, request, "60px") | n,unicode }
           var files = $('#inputfile')[0].files[0];
           fd.append('inputfile', files);
           var file_size = files.size;
-          $.ajax({
-            url:"/indexer/api/indexer/upload_local_file",
-            type: 'post',
-            data: fd,
-            contentType:false,
-            cache: false,
-            processData:false,
-            success:function (response) {
-              viewModel.createWizard.source.path(response['local_file_url']);
-            }
-          });
+          if (file_size > 200000) {
+                $.jHueNotify.warn("${ _('File size exceeds the supported size (200 KB).') }");
+              }
+          else {
+            $.ajax({
+              url:"/indexer/api/indexer/upload_local_file",
+              type: 'post',
+              data: fd,
+              contentType:false,
+              cache: false,
+              processData:false,
+              success:function (response) {
+                viewModel.createWizard.source.path(response['local_file_url']);
+              }
+            });
+          }
         };
 
       $('.importer-droppable').droppable({