php: Warning: rename The filename, directory name, or volume label syntax is incorrect. (code: 123)

∥☆過路亽.° 提交于 2019-12-11 08:29:42

问题


Since I am trying to copy my file I am getting this error, I am using windows 8.1

Warning: rename(../user/will/video/javascript-toggle-buttons-MonMar09122015-7491.mp4,../user/will/video/video-SunMar-15-18:03-2015-shared.mp4): The filename, directory name, or volume label syntax is incorrect. (code: 123) in E:\xampp\htdocs\social_media\root\php_parsers\status_system.php on line 353

this is I am trying to do,

if (file_exists("../user/$author/$folder/$file")) {
    if (!file_exists("../user/$account_name/$folder")){
        mkdir("../user/$account_name/$folder/",0755);
    }
    copy("../user/$author/$folder/$file","../user/$account_name/$folder/$file");
    $dbnewFile = $newFileName.'.'.$fileExt;
    // for rename purpose
    $oldName = "../user/$account_name/$folder/$file";
    $newName = "../user/$account_name/$folder/$dbnewFile";
    rename($oldName, $newName);
}

What's wrong with this? I am tired of watching this error :( and really frustrated.


回答1:


The problem is in the file name video-SunMar-15-18:03-2015-shared.mp4. Colons are not allowed in Windows filenames.

Please see this list for more information about invalid characters.



来源:https://stackoverflow.com/questions/29053800/php-warning-rename-the-filename-directory-name-or-volume-label-syntax-is-inc

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!