1
我在我的網站上下載了一個pdf文件的Flash下載。as3文件下載限制?
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文件的名稱,從而使文件不可用。有沒有辦法限制客戶改變擴展?
我認爲你不能從節約與另一部分下載的文件限制用戶。它只是文件名的一部分,特別是當涉及到Linux時,甚至在Windows中它不再起到關鍵作用,在長名稱引入後,名稱+ ext被合併到一個數據字段中。 – Vesper 2013-03-21 11:14:09