Because it isn't a valid path.
Look at your code: you start with
and your base directory is (say) the folder "
"You remove the "
Then you prefix the Base directory:
and what might be a file name (say "
") to get what you use as a URI:
Which isn't a valid path at all, and you seem surprised that the system picks up on that?
And then you ignore that and try to use the original folder all on it's own ...
Just like your previous (related) question, you need to think about exactly what you are trying to do and use the debugger to find out exactly what is happening in your code.
To be honest, 60 seconds with the debugger would have shown you exactly what was in
and you wouldn't have had to wait 18 hours for a response. I have to say that together with your previous question you do appear to be coding this using "guess and hope" instead of planning, and relying on others to fix it for you when it all fails.
That isn't a viable development technique going forward!