I have come across a tutorial that shows you how to encrypt files in the client-side encryption model using the crypto-js library and the problem is that the tutorial has created a limitation for the file size to be 1MB and I want to increase the limitation of this.
My question is how can I achieve that?
The tutorial: https://tutorialzine.com/2013/11/javascript-file-encrypter
Change the value in the conditional check below (this snippet is from the tutorial link you referenced) to something larger.
1024 bytes is 1KB, multiplied by 1024 is 1 MB. As an example, if you want the limit to be 5 MB, use 5*1024*1024
.
if(file.size > 1024*1024){
alert('Please choose files smaller than 1mb, otherwise you may crash your browser. \nThis is a known issue. See the tutorial.');
return;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.