【问题标题】:Not able to run upload.php using YUI Uploader无法使用 YUI Uploader 运行 upload.php
【发布时间】:2009-11-23 07:56:36
【问题描述】:

我正在尝试通过 using this example 让 YUI 上传器在我的计算机/本地主机上工作。 页面使用的 javascript,can be view here

上传按钮有以下处理程序:

YUE.on('upload', 'click',  this.upload, null, this);

(...)

upload : function(e) {
    YUD.get('browse').style.display = 'none';

    this.uploader.disable();
    this.uploader.uploadAll('wp-content/themes/storelocator/include/upload.php', 'GET');
},

PHP 文件如下所示:

<?php
  echo "TEST";
?>

当我点击上传按钮时,页面被重新加载,但没有回显。上传按钮是简单的html按钮&lt;button id="upload"&gt;Upload&lt;/button&gt;

“test”没有回显有什么原因吗?

【问题讨论】:

    标签: php javascript yui yui-uploader


    【解决方案1】:

    好吧,我从未使用过 YUI 框架,但我知道的每个上传脚本都会在页面某处创建一个隐藏的 iframe,因为无法使用 ajax 上传文件。

    我相信脚本可以工作,只需使用 firebug 找到隐藏的 iframe,您就会在其中发现您的 TEST 字符串已回显。

    【讨论】:

    • YUI Uploader 使用 Flash。而 this.uploader 就是那个 flash 程序的一个实例。
    【解决方案2】:

    在uploadAll中,需要指定绝对路径。指定相对路径将不起作用。因此,与其将其设置为:'wp-content/themes/storelocator/include/upload.php',不如将其设为'http://www.yourdomain.com/wp-content/themes/storelocator/include/upload。 php'.希望这会有所帮助!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-24
      • 1970-01-01
      • 2012-10-30
      • 1970-01-01
      相关资源
      最近更新 更多