| | |
| | | }, |
| | | |
| | | MAX_FILE_SIZE: 4608000, //Max file size 4.5 MB |
| | | CHUNK_SIZE: 750000, //Chunk Max size 750Kb |
| | | CHUNK_SIZE: 750000, //Chunk Max size 750Kb //2023-03-07 zhj 之前是750000 |
| | | uploadHelper: function(component, event) { |
| | | // start/show the loading spinner |
| | | component.set("v.showLoadingSpinner", true); |
| | |
| | | var fileInput = component.find("fileId").get("v.files"); |
| | | // get the first file using array index[0] |
| | | var file = fileInput[0]; |
| | | console.log('file.size 开始 = ' + file.length); |
| | | //var test = this.compress(file); |
| | | var self = this; |
| | | var pdf = file.type; |
| | |
| | | fileContents.length, |
| | | startPosition + this.CHUNK_SIZE |
| | | ); |
| | | if (startPosition < endPosition) { |
| | | this.uploadInChunk( |
| | | component, |
| | | file, |
| | | fileContents, |
| | | startPosition, |
| | | endPosition, |
| | | '' |
| | | ); |
| | | } |
| | | // if (startPosition < endPosition) { |
| | | // this.uploadInChunk( |
| | | // component, |
| | | // file, |
| | | // fileContents, |
| | | // startPosition, |
| | | // endPosition, |
| | | // '' |
| | | // ); |
| | | // } |
| | | let staticResource = component.get('v.staticResource'); |
| | | var reader = new FileReader(); |
| | | reader.readAsDataURL(file.slice(0, endPosition)); |
| | | console.log('file.size 调用 = ' + file.length); |
| | | reader.readAsDataURL(file); |
| | | var that = this; |
| | | reader.onloadend = function(evt){ |
| | | if(evt.target.readyState == FileReader.DONE){ |
| | |
| | | fileContents.length, |
| | | startPosition + this.CHUNK_SIZE |
| | | ); |
| | | if (startPosition < endPosition) { |
| | | this.uploadInChunk( |
| | | component, |
| | | file, |
| | | fileContents, |
| | | startPosition, |
| | | endPosition, |
| | | '' |
| | | ); |
| | | } |
| | | // if (startPosition < endPosition) { |
| | | // this.uploadInChunk( |
| | | // component, |
| | | // file, |
| | | // fileContents, |
| | | // startPosition, |
| | | // endPosition, |
| | | // '' |
| | | // ); |
| | | // } |
| | | let staticResource = component.get('v.staticResource'); |
| | | var reader = new FileReader(); |
| | | reader.readAsDataURL(file.slice(0, endPosition)); |
| | | reader.readAsDataURL(file); |
| | | var that = this; |
| | | reader.onloadend = function(evt){ |
| | | if(evt.target.readyState == FileReader.DONE){ |