Re: fopen with nasty pathnames

From: Date: Sun, 12 Jan 2003 11:21:23 +0000
Subject: Re: fopen with nasty pathnames
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-131324@lists.php.net to get a copy of this message
Gerald Timothy Quimpo wrote:
On Sunday 12 January 2003 07:08 am, Mat Harris wrote:
Patti\ Smith/Horses\ \[1975\]/01-Gloria.mp3 but fopen will still refuse saying file not found. I have tried escaped and unescaped amnd yes, I am very sure the file is there. How can I get fopen to accept a path like this?
$in=fopen("a filename with spaces in it.mp3","r"); works for me. how are you getting filenames? it might be that it's the directory reading functions that are giving you bad filenames. (although, i just tried (not copy-pasted, so close but not exactly what i tested): $dir=opendir("."); while(($dd=readdir($dir))!=false)
      print("$dd\n");
closedir($dir); and that works for a directory that has files with spaces in them. all filenames are printed, including the names that have spaces. another possibility, are those backslashes just for displaying? or are they actually there in the filename on disk? if the backslashes are actual parts of the filename (they shouldn't be, but the world is weird) then you'll need to escape them. "\\". tiger
not escaping the filename worked. weird. i spend a good hour writing a function to make sure they were properly escaped. i thought i tried it this way before, but never mind. thanks -- Mat Harrison Network Systems Administrator mat.harris@genestate.com www.genestate.com

Attachment: [application/pgp-signature]
« previous php.general (#131324) next »