Hello dear users of the project!
I wrote a file downloader for my site from my static server, and I encountered the following problem: when downloading various pictures they have the same size 2 147 483 647 bytes (a.bytesTotal) Screenshot while the pictures themselves are several times smaller. Can you tell me what the problem is?
Some of the files that tried to download: 16.jpg 8.jpg
The point here is clearly not in http and https, since I tried it anyway.
Source AS3:
import flash.events.*; import flash.net.FileReference; import flash.net.URLRequest; import flash.net.FileFilter; import flash.external.ExternalInterface; var downloadURL:URLRequest; var fileName:String = this.root.loaderInfo.parameters['fname']; var file:FileReference; function FileReferencedownload(a:MouseEvent):void { function closewindow(a:Event):void { ExternalInterface.call("UMBRELLA.plugins.mainWindow.thisclose"); trace("Close event"); } downloadURL = new URLRequest(); downloadURL.url = decodeURIComponent(this.root.loaderInfo.parameters['url'])+"?rnd="+Math.random(); file = new FileReference(); file.addEventListener(Event.CANCEL, closewindow); file.addEventListener(Event.COMPLETE, closewindow); file.addEventListener(ProgressEvent.PROGRESS, function(a:ProgressEvent) { var b:Number = Math.floor(Number(a.bytesLoaded / (a.bytesTotal / 100))); loadlabel.htmlText = "<font size='12' color='#FFFFFF'>"+b.toString()+"% (Загружено "+a.bytesLoaded+" из "+a.bytesTotal+" байт)</font>"; bar.setProgress(b, 100); if (b > 97) { cancel.visible = false; } }); file.addEventListener(Event.SELECT, function(a:Event) { closebutton.visible = false; downbutton.visible = false; loadbg.visible = true; loadlabel.visible = true; cancel.visible = true; bar.visible = true; cancel.addEventListener(MouseEvent.CLICK, function(a:Event) { file.cancel(); ExternalInterface.call("UMBRELLA.plugins.mainWindow.thisclose"); }); }); file.addEventListener(IOErrorEvent.IO_ERROR, function(a:IOErrorEvent) { closebutton.visible = false; downbutton.visible = false; loadlabel.htmlText = "<font size='12' color='#FFFFFF'>Ошибка "+a.errorID+", файл не найден</font>"; loadlabel.x = 55; loadlabel.autoSize = "center"; loadlabel.visible = true; cancelerr.visible = true; cancelerr.addEventListener(MouseEvent.CLICK, closewindow); }); file.addEventListener(HTTPStatusEvent.HTTP_STATUS, function(a:HTTPStatusEvent) { closebutton.visible = false; downbutton.visible = false; loadlabel.htmlText = "<font size='12' color='#FFFFFF'>Ошибка "+a.status+", файл не найден</font>"; loadlabel.x = 55; loadlabel.autoSize = "center"; loadlabel.visible = true; cancelerr.visible = true; cancelerr.addEventListener(MouseEvent.CLICK, closewindow); }); if (fileName=="undefined") { file.download(downloadURL); } else { file.download(downloadURL, fileName); } } downbutton.addEventListener(MouseEvent.CLICK, FileReferencedownload); closebutton.addEventListener(MouseEvent.CLICK, function(a:MouseEvent) { ExternalInterface.call("UMBRELLA.plugins.mainWindow.thisclose"); });