Page 1 of 1

Deleting files with special characters...

Posted: Mon Jun 23, 2008 7:43 am
by jkashu
How can I delete files with special characters with PHP? unlink() just gives me an error saying that the file doesn't exist.

Re: Deleting files with special characters...

Posted: Mon Jun 23, 2008 7:44 am
by Kieran Huggins
windows or linux?

Re: Deleting files with special characters...

Posted: Mon Jun 23, 2008 7:45 am
by jkashu
linux

Re: Deleting files with special characters...

Posted: Mon Jun 23, 2008 7:47 am
by Kieran Huggins
what characters are you having trouble with?
example?

Re: Deleting files with special characters...

Posted: Mon Jun 23, 2008 7:51 am
by jkashu
filenames with % ! " $ & : ? ...lots of crazy things...

The script that was being used on the website was saving pages as the title of the pages, so if the title had a ? or anything in it, it showed up in the filename and gave us problems.

2008:%20%22The%20Year%20of%20the%20River%22%20in%20Cedar%20Rapids21%20Jun%202008,%208:05%20am.php

Re: Deleting files with special characters...

Posted: Mon Jun 23, 2008 9:54 am
by Kieran Huggins
out on a limb here, but maybe escapeshellarg() would do the trick?