开发者

file_exists returning false for unknown reason

开发者 https://www.devze.com 2023-02-08 07:23 出处:网络
I have the following file: /home/user/public_html/web-site.org/download/audio/1999/01-03 Good News.mp3

I have the following file:

/home/user/public_html/web-site.org/download/audio/1999/01-03 Good News.mp3

The problem is that the error is thrown and the file is exited when it exists. I'm checking for file_exists because I'm doing a copy() later and it's failing cause the file doesn't existing. I'm hosted on hostGator and my permissions on these mp3s are 755.

if (!file_exists('/home/user/开发者_StackOverflowpublic_html/web-site.org/download/audio/'.$sermon['year'].'/'.$sermon['file'])) {
    echo "Oops, file doesn't exist: <b>/home/user/public_html/web-site.org/download/audio/".$sermon['year']."/".$sermon['file']."</b>";
    exit;
}

Could it be the space in the filename? I have about 1,100 audio files to process, so changing the filename manually would be a nightmare...

update

urlencode() and trim() on the filename has no effect

str_replace(' ', '-', $sermon['file']) on the filename doesn't work (after changing spaces to dashes in the filename itself)

I checked the permissions on the folder the file is in, it WAS 700 and I changed it to 755 and it had no effect.

update

I read in another thread that having a . in the path anywhere could cause a problem... so I changed .org to _org and the problem persisted, so I've reverted those changes.


Try escaping the spaces in the filename.

/home/user/public_html/web-site.org/download/audio/1999/01-03\ Good\ News.mp3


wow.... fail on my part.... epic fail.... my user path was wrong

0

精彩评论

暂无评论...
验证码 换一张
取 消