diff options
author | hb123f <hbindu@research.att.com> | 2019-03-20 12:20:44 -0400 |
---|---|---|
committer | hb123f <hbindu@research.att.com> | 2019-03-20 14:13:55 -0400 |
commit | a70761c096192e38800bf38d6c7f61f52bf72007 (patch) | |
tree | cdc5264cec030bc7e677ff1d74c939c56ee51d0d /ecomp-portal-widget-ms/widget-ms/src/main/resources/templates/Upload.html | |
parent | 3992004ee5f2b0b1635e2aef19c375db87079b52 (diff) |
CADI AAF Integration and merging the code
Issue-ID: PORTAL-319
CADI AAF Integration and code merge
Change-Id: I6e44f3b2741858d8d403b77a49ec9a0153084801
Signed-off-by: hb123f <hbindu@research.att.com>
Diffstat (limited to 'ecomp-portal-widget-ms/widget-ms/src/main/resources/templates/Upload.html')
-rw-r--r-- | ecomp-portal-widget-ms/widget-ms/src/main/resources/templates/Upload.html | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/resources/templates/Upload.html b/ecomp-portal-widget-ms/widget-ms/src/main/resources/templates/Upload.html index a5e7c632..01e0564b 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/resources/templates/Upload.html +++ b/ecomp-portal-widget-ms/widget-ms/src/main/resources/templates/Upload.html @@ -1,12 +1,45 @@ <html> +<script> +var validFileExtensions = [".zip"]; +function validateInput(form) { + var arrInputs = form.getElementsByTagName("input"); + for (var i = 0; i < arrInputs.length; i++) { + var oInput = arrInputs[i]; + if (oInput.type == "file") { + var fileName = oInput.value; + if (fileName.length > 0) { + var valid = false; + for (var j = 0; j < validFileExtensions.length; j++) { + var inputExtension = validFileExtensions[j]; + if (fileName.substr(fileName.length - inputExtension.length, inputExtension.length).toLowerCase() == inputExtension.toLowerCase()) { + valid = true; + break; + } + } + if (!valid) { + document.getElementById("error").style.display=""; + setTimeout(function(){ document.getElementById("error").style.display="none";}, 3000); + return false; + } + } + } + } + + return true; +} +</script> <body> <div align="center"> - <form method="post" action="doUpload/widget-resources" enctype="multipart/form-data"> + <form method="post" action="doUpload/widget-resources" onSubmit="return validateInput(this);" enctype="multipart/form-data"> <table border="0"> <tr> <td>Pick file:</td> <td><input type="file" name="fileUpload" size="50" /></td> </tr> + <tr colspan="2"> + <td><span style="display:none;color:red" id="error">File must be zip.</span></td> + + </tr> <tr> <td colspan="2" align="center"><input type="submit" value="Upload" /></td> </tr> |