0

I can't unlink file with php if there is & in file name.

unlink('../mydoc/in&out.pdf');

The error said: no such file or directory

  • Try escaping the `&` like so: `unlink('../mydoc/in\&out.pdf');` – Sammitch Feb 06 '13 at 16:28
  • if you have a special char in the filename you need to escape this char with \. unlink('../mydoc/in\&out.pdf'); – mjspier Feb 06 '13 at 16:28
  • Then adjust the file path to find it :D And escape & – nowhere Feb 06 '13 at 16:28
  • possible duplicate of [Delete files with special characters in filenames](http://stackoverflow.com/questions/4557047/delete-files-with-special-characters-in-filenames) – Nanne Feb 06 '13 at 16:29

2 Answers2

1

You should escape special characters.

 unlink('../mydoc/in\&out.pdf');
Nanne
  • 64,065
  • 16
  • 119
  • 163
0

You need to supply a full path to the file.