Click here to Skip to main content
15,612,987 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi there,

I need help escaping backslashes on a file download in with javascript. The file I am downloading is like this:


the file is being downloaded but being named as follows:

_Faheem-i5 ecordingsTTGILBetterValue�30122_195234_006387_1633548400

Can anyone explain to me why this is happening and how do i escape the double backslashes and single backslashes from the string.


1 solution

yes, u can do it with javascript:
var file_name = "\\Faheem\songs\TTGILBetterValue\000000.wav";
file_name = file_name.replace(/\\/g, "");

// NOTE: make sure that file_name contains \r, \n, \t chars or not...
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900