为什么我的javascript方法不会返回?

时间:2016-03-07 20:39:49

标签: javascript phonegap-plugins phonegap-build

目标:检查图像大小(使用PhoneGap Build)并在图像太大时返回。

问题:当图像超出界限时会引发错误,但无论如何都会继续上传。即使相同功能中的类似检查确实返回。

for (var i = 0; i < this.pageContainer.items.length; i++) {
  resolveLocalFileSystemURL(this.pageContainer.items.items[i].imageURI, function(fileEntry){
    fileEntry.file(function(fileObj){
      if (maxUploadSize <= fileObj.size){
        Ext.Msg.alert("Error", "Chosen image is too large. Choose a different image.");   
        return;
      }
    })
  })
}
// Only continue with a valid internet connection
if(!at.util.Connection.isOnline()) {
  return;
}

// Upload the first page
this.timeStamp = at.util.Navigation.showLoading();

firstPageURI = this.pageContainer.items.items[0].imageURI;

globalDocumentUploadComponentId = this.getId();

// Call the upload function
at.util.Images.uploadDocument(globalUploadDocumentSuccess, firstPageURI, documentTypeId, this.affectedEntityId, issuedDate, expirationDate, neverExpire, issuingCountry, issuingState, this.restrictionId, null);

编辑:我认为它与resolveLocalFileSystemURL(Url, resOnSuccess, resOnError);之后提出的文章不同,我认为我的if语句取代了错误。

0 个答案:

没有答案