2011-11-14 59 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,它工作得很好。

現在我必須弄清楚爲什麼它會刪除該服務器上文件名的第一個字母,但不是舊的...