Goal: Check size of image (using PhoneGap Build) and return if image is too large.
Problem: Error is thrown when image is out of bounds, but the upload continues anyway. Even though similar checks in the same function actually do return.
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);
Edit: I thought it was different than the proposed article since resolveLocalFileSystemURL(Url, resOnSuccess, resOnError); and I thought my if statement was taking the place of the on error. 
