php: 警告:重命名文件名、目录名或卷标语法不正确.(代码:123) [英] php: Warning: rename The filename, directory name, or volume label syntax is incorrect. (code: 123)

查看:46
本文介绍了php: 警告:重命名文件名、目录名或卷标语法不正确.(代码:123)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于我正在尝试复制我的文件,因此出现此错误,我使用的是 Windows 8.1

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

警告:重命名(../user/will/video/javascript-toggle-buttons-MonMar09122015-7491.mp4,../user/will/video/video-SunMar-15-18:03-2015-shared.mp4):文件名、目录名或卷标语法不正确.(代码:123)在 E:\xampp\htdocs\social_media\root\php_parsers\status_system.php 第 353 行

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

这是我想要做的,

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.

推荐答案

问题出在文件名video-SunMar-15-18:03-2015-shared.mp4.Windows 文件名中不允许使用冒号.

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.

这篇关于php: 警告:重命名文件名、目录名或卷标语法不正确.(代码:123)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆