权限验证:
var fileRef:FileReference = new FileReference(); var request:URLRequest = new URLRequest(serviceUrl); request.method = URLRequestMethod.POST; var encoder : Base64Encoder = new Base64Encoder(); encoder.encode(userName + ":" + password); request.requestHeaders.push(new URLRequestHeader("Authorization", "Basic " + encoder.toString())); // ** 增加认证信息 fileRef.addEventListener(Event.OPEN, onFileDownloadBegin); fileRef.addEventListener(Event.COMPLETE, onFileDownloadComplete); fileRef.addEventListener(IOErrorEvent.IO_ERROR, onFileDownloadError); fileRef.addEventListener(Event.CANCEL, onFileDownLoadCancel); fileRef.download(request, getExportFileName(serviceUrl));
Flex: 使用URLRequest进行下载, 并监听有关事件 <->
// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.