i have a variable which gets a text string with few "\" in it i need to write it into file but can't cause of the \
[man]stripslashes[/man]
thanks
that's the code i tried with
$path=addslashes($data['dir']); $filename="$path$id.mls"; $fp = fopen($filename, "w"); fwrite($fp,addslashes($data['url'])); fclose($fp);
where $data['dir'] is \kry4ma\movies2\some name\
and i got this error Warning: fopen(\\kry4ma\movies2\some+name\2.mls): failed to open stream
you're adding slashes to it twice
"where $data['dir'] is \kry4ma\movies2\some name\ "
\kry4ma\movies2\some name\ is the path, the users inputs in that way, with the slashes
and i need to save it in a file, but can't cause of the slashes and with the way i use addslashes i just double them.....
You could so something like this
$path = str_replace(chr(92),'\',$path); //echo the path to the file.
then when you read it in do this
$patn = str_replace('\',chr(92),$path);
thanks but i have to save it in .mls file which will be read from a movie player, and it has to be in the proper format "\kry4ma\movies2\some name\movie.avi"
so i need to save it exactly that way, but do not know how
or you could configure your web server so that .mls files were parsed by php and then you could put what ever php within those files that you wanted to.