简体   繁体   中英

$http.post File Size Limit? Sure looks like it

I am currently working on a project that is requiring me to use AngularJS's $http.post to upload Base64 encoded file contents to a server, where the file contents will be converted and saved to a remote repository.

The file that I am uploading is about 2.31 MB, yet after the server receives the file contents through the $http.post method, the file contents are only 68 K in size! What happened?

I am pretty sure that, because my file contents are in Base64 format, I am not having an issue with string termination due to embedded nulls, am I?

I am mostly wondering if there is a byte limit to the $http.post method. I havn't found my answer anywhere else.

Should I chop my file contents up, tell the server that I am starting an upload, do multiple upload chucks to the server, and then tell the server when I am done?

Silly me...

So, the entire 2.31 MB were coming across to the server, yet I was truncating the file contents by only allocating a buffer that was just under 65K, the max limit to a TCP/IP packet. Simply enough, I just need to make my buffer size dynamic to the incoming packet, after the packet has been reconstructed. Thanks for all the help guys.

I'm quoting this from the third answer in this question :

Maybe you have an & in your content variable. Then everything after that would be stripped after that.

So maybe in the base64-encoded file, there's an & somewhere alone the 68000th character chopping off the rest of the file since it thinks there is another request attached.

Something like: http://www.example.com?post=324b6bjgj5jhg&fgdhgtuhuf will present $_GET['post'] as 324b6bjgj5jhg rather than 324b6bjgj5jhg&fgdhgtuhuf . The & makes it think there's another variable. I know this is a GET request but I guess something similar could be happening in POST , too.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM