PHP 替换功能不适用于 Internet Explorer 8

发布于 2024-12-10 10:05:07 字数 1904 浏览 0 评论 0原文

我的网站有一个小问题,它是一个免费的分类广告网站,人们可以将照片上传到他们的广告等。

问题:我的上传脚本在我所有的计算机上都能完美运行,但是当我检查我的 Error_Log 时,它显示了很多的人无法上传他们的图片(它确实上传到临时文件夹中,但是当我使用重命名功能将其复制到广告文件夹中时,它不起作用并说:没有这样的文件等等等等。所以我发现有人有上传的问题并实现internet explorer 它

我的版本是:

Mozilla/5.0(兼容;MSIE 9.0;Windows NT 6.1;WOW64;Trident/5.0),

似乎工作正常,他使用的版本是:

Mozilla/4.0(兼容;MSIE 8.0;Windows) NT 6.0;三叉戟/4.0;.NET CLR 2.0.50727; 5.0;.NET CLR 3.5.30729;.NET CLR 3。

这不起作用,

有什么原因导致我的函数在 Internet Explorer 9.0、Firefox 和 Chrome 中工作,但在 IE 8 中不起作用

? > (这是将文件从用户的临时文件夹传输到广告文件夹的代码:)

mkdir("./users/".$this->Username."/".$Id, 0755);
mkdir("./users/".$this->Username."/".$Id.'/thumbnail', 0755);
$Files_List = explode("@",$_POST['Files_Names']);
for($i = 0;$i < count($Files_List);++$i)
{
    if($Files_List[$i] != "")
    {
        rename('./users/'.$this->Username.'/temp/'.$Files_List[$i], './users/'.
        $this->Username.'/'.$Id.'/'.$Files_List[$i]);
        rename('./users/'.$this->Username.'/temp/thumbnail/'.$Files_List[$i], './users/'.
        $this->Username.'/'.$Id.'/thumbnail/'.$Files_List[$i]);
    }
}
$dir = './users/'.$this->Username.'/temp/';
foreach(glob($dir.'*.*') as $v)
    unlink($v);
$dir = './users/'.$this->Username.'/temp/thumbnail/';
foreach(glob($dir.'*.*') as $v)
    unlink($v);

echo '<script>window.location = "./message.php?Message=Publier";</script>';
exit(0);


Error message:


[17-Oct-2011 12:31:17] PHP Warning: rename>(./users/francois/temp/thumbnail/2590cd9217.jpg ,./users/francois/186/thumbnail/2590cd9217.jpg ) [href='function.rename'>function.rename]: No such file or directory>in /home/kesimard/public_html/Montreal/publier.php on line 70

Line 70 = rename('./users/'.$this->Username.'/temp/thumbnail/'.$Files_List[$i], './users/'. $this->Username.'/'.$Id.'/thumbnail/'.$Files_List[$i]);

I have a little problem with my website, it is a free classified ads website where people upload photos to their ad, etc.

Problem: my upload script work perfectly with all my computers, but when I check in my Error_Log it show that a lot of people can't upload their picture (it does upload in the temp folder but when I use the rename function to copy it in the ad folder it does not work and say: No such file blah blah blah. So I found someone who has the problem of uploading and realize that internet explorer was the problem.

My version is :

Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)

which seem to work fine and the version he is using is:

Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; .NET CLR 3.

which does not work.

Is there any reason why my function do work in Internet Explorer 9.0, Firefox, and Chrome but not in IE 8?

EDIT
(This is the code for transfering the files from temp folder of the user to the ad folder:)

mkdir("./users/".$this->Username."/".$Id, 0755);
mkdir("./users/".$this->Username."/".$Id.'/thumbnail', 0755);
$Files_List = explode("@",$_POST['Files_Names']);
for($i = 0;$i < count($Files_List);++$i)
{
    if($Files_List[$i] != "")
    {
        rename('./users/'.$this->Username.'/temp/'.$Files_List[$i], './users/'.
        $this->Username.'/'.$Id.'/'.$Files_List[$i]);
        rename('./users/'.$this->Username.'/temp/thumbnail/'.$Files_List[$i], './users/'.
        $this->Username.'/'.$Id.'/thumbnail/'.$Files_List[$i]);
    }
}
$dir = './users/'.$this->Username.'/temp/';
foreach(glob($dir.'*.*') as $v)
    unlink($v);
$dir = './users/'.$this->Username.'/temp/thumbnail/';
foreach(glob($dir.'*.*') as $v)
    unlink($v);

echo '<script>window.location = "./message.php?Message=Publier";</script>';
exit(0);


Error message:


[17-Oct-2011 12:31:17] PHP Warning: rename>(./users/francois/temp/thumbnail/2590cd9217.jpg ,./users/francois/186/thumbnail/2590cd9217.jpg ) [href='function.rename'>function.rename]: No such file or directory>in /home/kesimard/public_html/Montreal/publier.php on line 70

Line 70 = rename('./users/'.$this->Username.'/temp/thumbnail/'.$Files_List[$i], './users/'. $this->Username.'/'.$Id.'/thumbnail/'.$Files_List[$i]);

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

风柔一江水 2024-12-17 10:05:07

听起来更像是文件系统问题而不是浏览器问题。在 rename() 函数之前,尝试添加以下内容:

if (!file_exists('./users/' . $this->Username . '/' . $Id)) {
  mkdir('./users/' . $this->Username . '/' . $Id);
}
if (!file_exists('./users/' . $this->Username . '/' . $Id . '/thumbnail')) {
  mkdir('./users/' . $this->Username . '/' . $Id . '/thumbnail');
}

Sounds more like a filesystem issue than a browser issue. Before the rename() functions, try adding this:

if (!file_exists('./users/' . $this->Username . '/' . $Id)) {
  mkdir('./users/' . $this->Username . '/' . $Id);
}
if (!file_exists('./users/' . $this->Username . '/' . $Id . '/thumbnail')) {
  mkdir('./users/' . $this->Username . '/' . $Id . '/thumbnail');
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文