仅在 Windows 上出现 AS3 错误 2038



希望有人能帮我解决这个问题!

我已经在Flash中编写了一个简单的在线3d编辑器 - 它即将发布给选定的客户,但文件上传器有一个小故障,它刚刚抬起了丑陋的头。使用FileReference将媒体上传到https页面,它在OSX上就像一个梦想,这是它所构建的,但是在Windows上,它在每个浏览器上都返回错误2038。以前有人遇到过这种情况吗?

任何帮助非常感谢!

public class CustomFileReferenceList extends FileReferenceList {
    private var uploadURL:URLRequest;
    private var pendingFiles:Array;
    public static var length:int = 0;
    public static var arrLen:int = 0;
    public function CustomFileReferenceList() {
        uploadURL = new URLRequest();
        uploadURL.url = "https://___";
        var rqd:URLVariables = new URLVariables();
        uploadURL.method = URLRequestMethod.POST;
        rqd.sessionId = Main.sessionId;
        uploadURL.data = rqd;
        initializeListListeners();
    }
    private function initializeListListeners():void {
        addEventListener(Event.SELECT, selectHandler);
        addEventListener(Event.CANCEL, cancelHandler);
    }
    private function doOnComplete():void {
        //var event:Event = new Event(Uploader.LIST_COMPLETE);
        //dispatchEvent(event);
enter code here
    }
    private function addPendingFile(file:FileReference):void {
        pendingFiles.push(file);
        file.addEventListener(Event.OPEN, openHandler,false,0,true);
        file.addEventListener(Event.COMPLETE, completeHandler,false,0,true);
        file.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler,false,0,true);
        file.addEventListener(ProgressEvent.PROGRESS, progressHandler,false,0,true);
        file.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler,false,0,true);
        file.upload(uploadURL);
    }
    private function removePendingFile(file:FileReference):void {
        for (var i:uint; i < pendingFiles.length; i++) {
            if (pendingFiles[i].name == file.name) {
                pendingFiles.splice(i, 1);
                if (pendingFiles.length == 0) {
                    doOnComplete();
                }
                return;
            }
        }
    }
    private function selectHandler(event:Event):void {

        arrLen = length = fileList.length;
        pendingFiles = new Array();
        var file:FileReference;
        for (var i:uint = 0; i < fileList.length; i++) {
            file = FileReference(fileList[i]);
            addPendingFile(file);
        }
    }
    private function cancelHandler(event:Event):void {
        //var file:FileReference = FileReference(event.target);
    }
    private function openHandler(event:Event):void {
        var file:FileReference = FileReference(event.target);
    }
    private function progressHandler(event:ProgressEvent):void {
        var file:FileReference = FileReference(event.target);
    }
    private function completeHandler(event:Event):void {
        var file:FileReference = FileReference(event.target);
        length--;
        removePendingFile(file);
    }
    private function httpErrorHandler(event:Event):void {
        var file:FileReference = FileReference(event.target);
    }
    private function ioErrorHandler(event:Event):void {
        var file:FileReference = FileReference(event.target);
    }
    private function securityErrorHandler(event:Event):void {
        var file:FileReference = FileReference(event.target);
    }
}

在尝试了几乎所有解决方案之后,其他 Web 开发人员发现它可以正常工作,减去花哨的 url 名称,即引用我们的服务器/页面.php而不是我们的服务器/服务。绝对疯狂。

我今天有这个问题,就我而言,我是源(url/nativePath)的长度和目的地的长度的跟踪;我发现 destin url 的长度最多为 256 个字符。

为了解决这个问题,我被更改了目的地点(带有简单链接或网络驱动器)

例:

// MAC remote path
var mSt:String  = "file:////MacBook-Pro-de-Jaime.local/Seagate/netShared/transport-machines/SoftDepot/";
// Windows Remote Drive (\MacBook-Pro-...transport-machines)
// Remote MAC as Windows Drive N
var mSt:String  = "file:///N:/SoftDepot/";

瞧,新名字减少了几个字符。

相关内容

  • 没有找到相关文章

最新更新