I am currently utilizing angular-file-upload for batch file uploads, where I match file names to properties in a database. The structure of the files should follow this format:
01-1998 VRF RD678.pdf
VRF represents the pipeline name RD represents the location name 678 is the location code
Each property has its own conditional statement to check for matching files in the database. Currently, if there is no match or if the file name is incorrect, an error message is displayed.
I aim to achieve three objectives:
Create an error message that displays the file name and the specific conditional statement causing the error. If there's no match for the pipeline, I want the file name along with "no match for pipeline" below it.
Establish an error message for when the file name structure is incorrect. I want the file name followed by "incorrect filename."
Prevent the function from encountering errors; instead, display the error messages while allowing other files to be uploaded.
I'm exploring the use of linq.js and JavaScript is also acceptable.
Here's an example illustrating what I'm struggling with - an incorrectly structured file name triggers the following error message:
TypeError: Cannot read property 'name' of undefined
$scope.upload = function () {
var files = $scope.files;
if (files && files.length) {
for (var i = 0; i < files.length; i++) {
var file = files[i];
// additional script logic here
}
}
};