PHP replace double backslashes “\\” to a single backslash “\”
Question
Okay so im working on this php image upload system but for some reason internet explorer turns my basepath into the same path, but with double backslashes instead of one; ie:
C:\\Documents and Settings\\kasper\\Bureaublad\\24.jpg
This needs to become C:\Documents and Settings\kasper\Bureaublad\24.jpg.
Solution
Use the stripslashes
function.
That should make them all single slashes.
OTHER TIPS
Note that you may be running into PHP's Magic Quotes "feature" where incoming backslashes are turned to \\
.
Have you considered the stripslashes() function?
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow