diff --git a/apps/table.html b/apps/table.html
index ae8075125..ce1aae5c7 100644
--- a/apps/table.html
+++ b/apps/table.html
@@ -212,7 +212,7 @@
Upload New Slide
Steps for uploading.
- Select the file you wish to upload. The Token field should be automatically populated .
- - Enter the desired filename, including its extension, for the destination file.
+ - Provide the destination filename with extension. For example "sample.svs"
- Click on the button to preview the slide.
- Click on Finish Upload to complete the process and post the slide to caMicroscope.
diff --git a/apps/table.js b/apps/table.js
index a84ee48aa..6ae19530c 100644
--- a/apps/table.js
+++ b/apps/table.js
@@ -714,8 +714,22 @@ function fileNameChange() {
const fileName = fileNameInput.val();
let newFileName = fileName.split(' ').join('_');
fileNameInput.val(newFileName);
- let fileExtension = newFileName.toLowerCase().split('.').reverse()[0];
- if (!allowedExtensions.includes(fileExtension)) {
+ let fileParts = newFileName.split('.');
+ let fileExtension = fileParts.length > 1 ? fileParts.reverse()[0].toLowerCase() : null;
+ if (!fileExtension) {
+ fileNameInput.addClass('is-invalid');
+ let fDiv = document.getElementById('filename-feedback0');
+
+ if (!fDiv) {
+ fileNameInput.addClass('is-invalid');
+ let fDiv = document.createElement('div');
+ fDiv.classList.add('invalid-feedback');
+ fDiv.id = 'filename-feedback0';
+ fDiv.textContent = 'The file name you provided is incompatible. File names should follow this format "filename.ext"';
+ fileNameInput.parent().append(fDiv);
+ }
+
+ } else if (!allowedExtensions.includes(fileExtension)) {
fileNameInput.addClass('is-invalid');
let fDiv = document.createElement('div');
fDiv.classList.add('invalid-feedback');
@@ -734,6 +748,8 @@ function fileNameChange() {
}
}
}
+
+
function switchToFile() {
$('.urlUploadClass').css('display', 'none');
$('.fileInputClass').css('display', 'block');