diff options
-rw-r--r-- | vnfmarket/src/main/webapp/vnfmarket/common/directives/fileupload/fileuploadDirective.js | 10 | ||||
-rw-r--r-- | vnfmarket/src/main/webapp/vnfmarket/common/locale/locale-en.json | 2 |
2 files changed, 10 insertions, 2 deletions
diff --git a/vnfmarket/src/main/webapp/vnfmarket/common/directives/fileupload/fileuploadDirective.js b/vnfmarket/src/main/webapp/vnfmarket/common/directives/fileupload/fileuploadDirective.js index 3f64841d..43137a5a 100644 --- a/vnfmarket/src/main/webapp/vnfmarket/common/directives/fileupload/fileuploadDirective.js +++ b/vnfmarket/src/main/webapp/vnfmarket/common/directives/fileupload/fileuploadDirective.js @@ -43,7 +43,15 @@ function link(scope, element, attrs) { element.bind("change", function (changeEvent) { scope.$apply(function () { - scope.fileUpload = changeEvent.target.files[0]; + var fileType = changeEvent.target.accept; + var ext = "." + changeEvent.target.value.match(/\.(.+)$/)[1]; + scope.fileUpload = null; + if (typeof fileType == undefined || fileType == "") { + scope.fileUpload = changeEvent.target.files[0]; + } + else if ((Array.isArray(fileType) && fileType.indexOf(ext) > -1) || (fileType == ext)) { + scope.fileUpload = changeEvent.target.files[0]; + } }); }); } diff --git a/vnfmarket/src/main/webapp/vnfmarket/common/locale/locale-en.json b/vnfmarket/src/main/webapp/vnfmarket/common/locale/locale-en.json index d086b9ac..f82b567e 100644 --- a/vnfmarket/src/main/webapp/vnfmarket/common/locale/locale-en.json +++ b/vnfmarket/src/main/webapp/vnfmarket/common/locale/locale-en.json @@ -57,7 +57,7 @@ "fields": {
"fileUpload": {
"label": "Select File",
- "noFileSelected": "No file selected"
+ "noFileSelected": "No file selected (Select .csar file)"
},
"shortDescription": {
"placeholder": "Short Description"
|