介绍

我正在尝试在潜在的复杂环境中实现相对简单的目标。我想使用Netvibes UWA format将文件从JavaScript小部件(plupload jQuery UI plugin)上传到本地Intranet服务器。

问题

我似乎已经正确设置了我的代码-出现plupload容器,我可以很高兴地选择和上传文件。上载似乎有效-每个文件命中率100%-但是当我检查Firebug控制台时,出现以下错误:
OPTIONS upload.php - 403 Forbidden
而且文件不会上传到我指定的files目录中。

环境

  • 源服务器在内部IP 192.168.3.15上是frogserver.curriculum.local
  • 收件人服务器是内部IP 192.168.3.60上的staff.curriculum.local
  • Origin服务器是linux,但是我无法直接访问HTML/JS/PHP/SQL,所有操作都必须通过上述Netvibes Universal Widget API完成。这是由www.frogtrade.com提供的封闭式虚拟学习环境解决方案
  • 收件人服务器是Windows/IIS

  • 代码

    JavaScript
    widget.onLoad = function(){
        $( "#datetime" ).datepicker({ dateFormat: "yy-mm-dd" });
        Input.init();
    
        /* plupload */
        $("#uploader").plupload({
            // General settings
            runtimes : 'html5,flash,html4',
            url : 'http://staff.curriculum.local/frog/LOTS/upload.php',
            max_file_size : '1000mb',
            max_file_count: 20, // user can add no more then 20 files at a time
            chunk_size : '1mb',
            rename: true,
            multiple_queues : true,
    
            // Resize images on clientside if we can
            resize : {width : 320, height : 240, quality : 90},
    
            // Rename files by clicking on their titles
            rename: true,
    
            // Sort files
            sortable: true,
    
            // Specify what files to browse for
            filters : [
                {title : "Image files", extensions : "jpg,gif,png"},
                {title : "Zip files", extensions : "zip,avi"}
            ],
    
            // Flash settings
            flash_swf_url : '/user/74/186718.swf'
        });
    
        // Client side form validation
        $('form').submit(function(e) {
            var uploader = $('#uploader').plupload('getUploader');
    
            // Files in queue upload them first
            if (uploader.files.length > 0) {
                // When all files are uploaded submit form
                uploader.bind('StateChanged', function() {
                    if (uploader.files.length === (uploader.total.uploaded + uploader.total.failed)) {
                        $('form')[0].submit();
                    }
                });
    
                uploader.start();
            } else
                alert('You must at least upload one file.');
    
            return false;
        });
    }
    

    HTML
    <form  method="post" action="../dump.php">
        <div id="uploader">
            <p>Your browser doesn't have Flash, Silverlight, Gears, BrowserPlus or HTML5 support.</p>
        </div>
    </form>
    

    PHP

    我正在使用的PHP脚本是捆绑的upload.php文件处理脚本,其顶部还添加了以下代码:
    // * - stands for all domains
    header("Access-Control-Allow-Origin: *");
    

    我还更改了上传目录目标:
    // Settings
    //$targetDir = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload";
    $targetDir = 'files';
    

    思想
  • 我不确定这是否归类为“跨域”文件传输?我试图将其设置为正确,因此我的PHP脚本
  • 中的Access-Control-Allow-Origin header
  • Netvibes UWA和VLE设置可能会遇到问题,
  • Internet Guest帐户的LOTS文件夹上的IIS权限似乎是正确的(即“读取”权限),但是我不确定。它在“特殊权限”上具有“拒绝”,并且我似乎看不到这些权限是什么,或者更改了

  • 编辑:IIS权限

    刚刚检查,一切似乎正确:

    最佳答案

    [编辑] CORS

    权限似乎还不错,这可能是CORS问题。

    我偶然发现monsur对此问题的回答:Is it possible to use XMLHttpRequest across Domains,并引述:



    权限

    根据此doc:



    您可能正在检查错误用户的权限( IUSR_ASHVOIP ),尝试 IIS_WPG (似乎适合您)或 IIS_IUSRS ,具体取决于您的配置。

    10-05 21:06
    查看更多