Is there a way to urlencode except directory seperators / in the path ?
like
urlencode('/this/is/my/file right here.jpg');
Replace them again:
str_replace('%2F', '/', urlencode('/this/is/my/file right here.jpg'));
Note that if you are going to pass the result in a query string, you should not do the replacement above -- use only urlencode
. If you are using it in the path portion, you ought to use rawurlencode instead.
This should solve your problem.
str_replace("%2F","/",urlencode('/this/is/my/file right here.jpg'));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With