I have a Flex app that uploads files to our website.
We’re currently working on transferring over to a new website, and at the moment the new website has to be accessed by IP instead of domain name.
The upload app works just fine on the current server, but on the new server it gives an upload security error.
I tried adding the IP to the crossdomain.xml, but that didn’t fix it.
I’m hoping that when we switch over the DNS to the new server, it’ll just start working, but it’s pretty important that it works right, right away.
[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);
}
Never mind.
We changed the hosts file to allow us to use the domain name instead of the ip, and it worked just fine.
Now I have to figure out why it’s removing the first letter of the file name on this server but not the old one…