Answer the question
In order to leave comments, you need to log in
How to fix TypeError: Cannot read property 'length' of undefined?
In the local server everything works great, but in the VDS in the console I get an error.
Good evening, I need your help. I encountered such a problem after transferring the site from shared hosting to VDS. problems on Shared Hosting, everything works with a bang, but on VDS + ISPmanger it gives an error ((
here on VDS - fara.tmweb.ru/?p=5 (Add Track Button)
and here on regular hosting - tajrap.tj/dohlot
if anyone then he knows how to decide ready to thank Skype : [email protected]
}
function getData(files){
var filesData = [];
angular.forEach(files, function(file) {
if(file.error === false && file.newFileName.length > 0){
var temp = {};
if(file.sizeYt && file.ytID){
temp = {
'target_name':file.newFileName,
'size': $filter('formatBytes')(file.sizeYt,2),
'type': file.file.type ,
'ytID': file.ytID,
'duration': file.duration
};
}else{
temp = {
'target_name':file.newFileName,
'size': $filter('formatBytes')(file.size,2),
'type': file.file.type
};
}
}
Answer the question
In order to leave comments, you need to log in
Maybe it makes sense to calculate the length in the try / catch block in advance, catch the error and assign zero to the required variable, and check this variable already? Apparently, the data contains incorrect values, such as the pseudo-name of the current and parent directory (if we are talking about files, of course).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question