我在我的网站上有一个 Flash 下载来下载 pdf 文件。
var myfileReference:FileReference = new FileReference();
down_mc.visible = false;
down_comp.visible = false;
var myRequest:URLRequest = new URLRequest("GEORGIA INCORPORATED.pdf");
myfileReference.addEventListener(IOErrorEvent.IO_ERROR, ioError);
output_txt.text = "";
function ioError(event:ErrorEvent):void {
output_txt.text = "Sorry that there is an IO error during the file downloading. The error is:" + "\n" + event;
}
myfileReference.addEventListener(ProgressEvent.PROGRESS, fileDownloadProgress);
function fileDownloadProgress(event:ProgressEvent):void {
down_mc.visible = true;
}
myfileReference.addEventListener(Event.COMPLETE, fileDownloadCompleted);
function fileDownloadCompleted(evt:Event):void {
down_mc.visible = false;
down_comp.visible = true;
}
function downloadFile (event:MouseEvent):void {
try {
myfileReference.download(myRequest);
} catch (error:SecurityError) {
downloading. The error is:" + "\n" + error;
} catch (error:IllegalOperationError) {
downloading. The error is:" + "\n" + error;
}
}
b1.addEventListener(MouseEvent.CLICK, downloadFile);
问题是有些人想要更改他们正在下载的文件的名称并更改扩展名 .pdf ,从而使文件无法使用。有什么办法可以阻止客户更改扩展名?