Apache flex FileReference.download()适用于flex中的.jpg.txt文件,但不适用于.dgn文件
在使用以下代码下载文件时,它成功下载了.jpg.txt文件,但.dgn格式文件返回IO错误#2038,这让我感到惊讶 有人能给我一些建议吗?提前谢谢Apache flex FileReference.download()适用于flex中的.jpg.txt文件,但不适用于.dgn文件,apache-flex,Apache Flex,在使用以下代码下载文件时,它成功下载了.jpg.txt文件,但.dgn格式文件返回IO错误#2038,这让我感到惊讶 有人能给我一些建议吗?提前谢谢 protected function init(event:FlexEvent):void { fileRef = new FileReference(); fileRef.addEventListener(Event.COMPLETE, doEvent);
protected function init(event:FlexEvent):void
{
fileRef = new FileReference();
fileRef.addEventListener(Event.COMPLETE, doEvent);
fileRef.addEventListener(HTTPStatusEvent.HTTP_STATUS, doEvent);
fileRef.addEventListener(IOErrorEvent.IO_ERROR, doEvent);
fileRef.addEventListener(SecurityErrorEvent.SECURITY_ERROR, doEvent);
}
private function doEvent(evt:Event):void
{
var fr:FileReference = evt.currentTarget as FileReference;
switch (evt.type)
{
case "complete":
Alert.show("File : " + fr.name + " download succeed");
break;
default :
Alert.show("Error occur during downloading !!!");
break;
}
protected function downLoadLICMap(event:MouseEvent):void
{
urlReq = new URLRequest("http://svygis/viewphoto/ceddphoto/20130916 raw/1se19d.dgn");
fileRef.download(urlReq);
}
我怀疑Flex不是这里的错。这可能是服务器设置问题。
您是否尝试过直接在浏览器中打开该URL?您可能也无法下载这样的文件
如果是这种情况,您只需要在web服务器上为.dgn扩展配置mime类型,而不是服务器设置:它是否为.dgn扩展配置了mime类型?您是否尝试过直接在浏览器中打开该URL?(附带说明:URL中有一个空格;这不是一个很好的主意)我为dgn文件添加了MIME类型“application/octet stream”,它可以正常工作。非常感谢。我怎样才能把你的建议作为答案呢?我是新来的,我把它作为一个真实的答案贴了出来。现在可以使用它旁边的绿色复选标记将其标记为正确的。