开发者

Issues with cross-domain uploading

开发者 https://www.devze.com 2022-12-19 22:13 出处:网络
I\'m using a django plugin called django-filebrowser which utilizes uploadify. The issue I\'m having is that I\'m hosting uploadify.swf on a remote static media server, whereas my admin area is on my

I'm using a django plugin called django-filebrowser which utilizes uploadify. The issue I'm having is that I'm hosting uploadify.swf on a remote static media server, whereas my admin area is on my django server.

At first, the browse button wouldn't invoke my browser's upload. I fixed this by modifying the sameScriptAccess to always instead of sameDomain. Now the progress bar doesn't move at all, I probably have to enable some server setting for cross domain file uploading, or most likely actually host a separate upload script on my media server.

I thought I could solve this by adding a crossdomain.xml to enable any site at the root of both servers, but that doesn't seem to solve it.

$(document).ready(function() {
    $('#id_file').uploadify({
        'uploader'          : 'http://media.site.com:8080/admin/filebrowser/uploadify/uploadify.swf',
        'script'            : '/admin/filebrowser/upload_file/',
        'scriptData'        : {'session_key': '...'},
        'checkScript'       : '/admin/filebrowser/check_file/',
        'cancelImg'         : 'ht开发者_开发问答tp://media.site.com:8080/admin/filebrowser/uploadify/cancel.png',
        'auto'              : false,
        'folder'            : '',
        'multi'             : true,
        'fileDesc'          : '*.html;*.py;*.js;*.css;*.jpg;*.jpeg;*.gif;*.png;*.tif;*.tiff;*.mp3;*.mp4;*.wav;*.aiff;*.midi;*.m4p;*.mov;*.wmv;*.mpeg;*.mpg;*.avi;*.rm;*.pdf;*.doc;*.rtf;*.txt;*.xls;*.csv;',
        'fileExt'           : '*.html;*.py;*.js;*.css;*.jpg;*.jpeg;*.gif;*.png;*.tif;*.tiff;*.mp3;*.mp4;*.wav;*.aiff;*.midi;*.m4p;*.mov;*.wmv;*.mpeg;*.mpg;*.avi;*.rm;*.pdf;*.doc;*.rtf;*.txt;*.xls;*.csv;',
        'sizeLimit'         : 10485760,
        'scriptAccess'      : 'always',
        //'scriptAccess'      : 'sameDomain',
        'queueSizeLimit'    : 50,
        'simUploadLimit'    : 1,
        'width'             : 300,
        'height'            : 30,
        'hideButton'        : false,
        'wmode'             : 'transparent',
        translations        : {
                              browseButton: 'BROWSE',
                              error: 'An Error occured',
                              completed: 'Completed',
                              replaceFile: 'Do you want to replace the file',
                              unitKb: 'KB',
                              unitMb: 'MB'
        }
    });
    $('input:submit').click(function(){
        $('#id_file').uploadifyUpload();
        return false;
    });
});

The page I'm viewing this on is http://site.com/admin/filebrowser/browse on port 80.


Does hosting the SWF locally help?

0

精彩评论

暂无评论...
验证码 换一张
取 消