Jquery error : too much recursion

后端 未结 1 1262
一向
一向 2021-01-17 02:27

I\'m trying to create a file upload system implementing client side encryption using CryptoJS.

The problem I\'m having is that execution of the script is stopped by

相关标签:
1条回答
  • 2021-01-17 03:10

    The issue is that CryptoJS functions return objects not strings, so you have to stringify it before you attempt to send it.

        var jqxhr = $.ajax({
            url: "/api/files/upload",
            type: "POST",
            data: {
                'name': fname,
                'data': fdata.toString(),
                'key': skey.toString()
            }
        });
    

    http://jsfiddle.net/wob66Lc0/1/

    Also encryption works on bytes not text so you should read the file as a binary string instead of text

    fr.readAsBinaryString(input.files[0]); 
    
    0 讨论(0)
提交回复
热议问题