2011-11-14 35 views
0

我有一个Flex应用程序将文件上传到我们的网站。 我们目前正在转移到一个新的网站,目前新的网站必须通过IP访问,而不是域名。Flex上传安全错误

上传应用程序在当前服务器上工作得很好,但在新服务器上,它会产生上传安全错误。

我尝试将IP添加到crossdomain.xml,但没有解决它。

我希望当我们将DNS切换到新的服务器时,它会刚刚开始工作,但它很重要,它的工作原理很正确。

[Event(name="uploadSecurityError", type="flash.events.SecurityErrorEvent")] 
private var _refUploadFile:FileReference; 

private function continueUpload():void { 
    disableUI(); 
    if(AlertReturn){ 
     if (_arrUploadFiles.length > 0) { 
      listFiles.selectedIndex = _numCurrentUpload; 
      scrollFiles(); 
      // Variables to send along with upload 
      var sendVars:URLVariables = new URLVariables(); 
      sendVars.dir = String(cboDir.selectedItem.data); 
      sendVars.uname = String(cboUsername.selectedItem.data); 
      sendVars.timekey = TimeKey; 
      sendVars.proc = 0; 

      var request:URLRequest = new URLRequest(); 
      request.data = sendVars; 
      request.url = _strUploadUrl; 
      request.method = URLRequestMethod.POST; 
      _refUploadFile = new FileReference(); 
      _refUploadFile = listFiles.selectedItem.file; 
      _refUploadFile.addEventListener(ProgressEvent.PROGRESS, onUploadProgress); 
      _refUploadFile.addEventListener(Event.COMPLETE, onUploadComplete); 
      _refUploadFile.addEventListener(IOErrorEvent.IO_ERROR, onUploadIoError); 
      _refUploadFile.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onUploadSecurityError); 
      _refUploadFile.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA, uploadDataComplete); 
      _refUploadFile.upload(request, "file", false); 
     } 
    } 
} 

// Called on upload security error 
private function onUploadSecurityError(event:SecurityErrorEvent):void { 
    clearUpload(); 
    var evt:SecurityErrorEvent = new SecurityErrorEvent("uploadSecurityError", false, false, event.text); 
    dispatchEvent(evt); 
} 

回答

2

没关系。 我们更改了hosts文件,以允许我们使用域名而不是ip,它工作得很好。

现在我必须弄清楚为什么它会删除该服务器上文件名的第一个字母,但不是旧的...