Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Why does URLLoader.bytesTotal return a different value if the file is online or local?

Contributor ,
Jan 10, 2018 Jan 10, 2018

I've got an xml file in my AIR app and I'm trying to determine his size. Here's what I did (seems complex so I don't know if it's the good way to do it) :

function checking_version_of_horairesXML():void{  
var url_local:URLRequest = new URLRequest("horaires3.xml");
var url_online:URLRequest = new URLRequest("http://www.mywebsite.nc/horaires3.xml");  

// Define the URLLoader.
var loader_local:URLLoader = new URLLoader();
loader_local.load(url_local);

var loader_online:URLLoader = new URLLoader();
loader_online.load(url_online); 

// Listen for when the file has finished loadingl
oader_local_Complete loader_local.addEventListener(Event.COMPLETE, loader_local_Complete);
loader_online.addEventListener(Event.COMPLETE, loader_online_Complete);  

function loader_local_Complete(e:Event):void { 
trace("size of local file : " + (URLLoader(e.target).bytesTotal));


function loader_online_Complete(e:Event):void {  t
race("size of online file : " + (URLLoader(e.target).bytesTotal)); 
}

 

It seems that the code for the local file is working as I'm getting in output :

 

size of local file: 703693

 

But I've uploaded the exact same file on my server and I have this in output :

 

size of online file : 60243

 

Why am I getting different results as these 2 files are identical ?

TOPICS
ActionScript
544
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Contributor , Jan 10, 2018 Jan 10, 2018

Weirdly, I've tried to upload it to a different server that I have (.com instead of .nc) and, the size is still different, but different that the .nc server file too (it is the SAME file) :

size of my local file : 703693

size of my online file on mywebsite.nc : 60243

size of my online file on mywebsite.com : 673031

EDIT :

Everything is getting weirder and weirder :

It seems that it depends of the server.

I've got a VPS server too. So I've tried to upload it to this one and the size is correctly disp

...
Translate
Community Expert ,
Jan 10, 2018 Jan 10, 2018

the files are different sizes.  recheck them.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jan 10, 2018 Jan 10, 2018

capture.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jan 10, 2018 Jan 10, 2018

Weirdly, I've tried to upload it to a different server that I have (.com instead of .nc) and, the size is still different, but different that the .nc server file too (it is the SAME file) :

size of my local file : 703693

size of my online file on mywebsite.nc : 60243

size of my online file on mywebsite.com : 673031

EDIT :

Everything is getting weirder and weirder :

It seems that it depends of the server.

I've got a VPS server too. So I've tried to upload it to this one and the size is correctly display : 703693

So, on my .nc server (region where I live) the size is incorrect

on my .com server the size is bigger but still incorrect

on my vps server the is correct.

Any logical explanation for this ?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 10, 2018 Jan 10, 2018
LATEST

i'm sure there is, but i don't know what it is.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines