i have string path like this "../music/Safe & Sound.mp3"
but when i tried to delete the file with PHP like this
if (!unlink($path))
{
echo "Error while deleting file";exit();
}
it shows the echo "Error while deleting file" and file failed to be deleted i have tried to rename the file manually by removing "&" character, unlink works perfectly
so how to delete a file using unlink with special character such as "&" on its filename?
You can try by following script
$path = '../music/Safe \& Sound.mp3'; /* I don't know about complete path I just want to let you know about file name */
if (!unlink($path))
{
echo "Error while deleting file";exit();
}
\
will escape the special character.