I am uploading images using nodejs
My query is like:
var user = req.body;
var imgurl=projectDir +"/uploads/"+req.files.displayImage.name;
var sql= "INSERT INTO users values('','"+user.name+"','"+user.email+"','"+user.user+"','"+user.pass+"','"+imgurl+"',now())";
Everything goes right, except when it inserts imgurl it does not parse it,
My project directory is D:\node
also I get it in projectDir =D:\node
But it will insert in database like:
D:
ode/uploads/canvas.png
I understand that it converts \n to new line,
So, my question is how to prevent this and what should I do for both single and double quotes insertion?
Thanks.