Replacing backslash with another symbol in PHP

Posted by Skyfe on Stack Overflow See other posts from Stack Overflow or by Skyfe
Published on 2010-03-20T10:26:55Z Indexed on 2010/03/20 11:01 UTC
Read the original article Hit count: 334

Filed under:
|
|
|
|

Hi there,

Been struggling with replacing a backslash by another symbol such as '.-.' just to indicate the position of backslashes as I could not send a string such as 'C\xampp\etc.' through url as GET variable so I thought I'd first replace the backslashes in that string by another symbol, then send through url, and then replace them back to backslashes in the PHP file that handles it. Though would there be a better way to send such strings through url? Because when I try a script such as:

$tmp_name = preg_replace("\", ".-.", $_FILES['uploadfile']['tmp_name']);

It turns out into a php error as \ is also used as delimiter..

Could anyone help me out on this?

Thanks in advanced!

Btw, if I'd be able to send a full array through url, this whole problem would be solved, but I don't think it's possible?

© Stack Overflow or respective owner

Related posts about php

Related posts about replace