I’m working on a blog website using Node + JS at https://rv-blog.glitch.me
In this project, we prompt the user to chat using text + image. The text part is working fine, the problem is with the image part. Firstly, there is a file input which process images (line no: 160-173, script.js), then we prepare and send a request string to server (line no: 117-132, script.js). There we had a console log, which logs the length of request string (line no: 128, script.js). At this point, client-side task is over.
Now, we have a Node server which captures the request string (line no: 27,28,29, in server.js). I’ve a problem here that, client and server logs different length of the same request string. I know client-side can’t be wrong as it is generating the string. My doubt is that the server is not completely capturing the string, as:
- it outputs a different length from the client
- it outputs different length every time, instead of a unique one
However, when I was trying this on localhost, I was fortunate once and the image got uploaded as shown below, so I guess my server-side code is working fine atleast.
EDIT
It works for small images as seen in screenshot: