# Bytes to Text?

**URL:** <https://forum.kirupa.com/t/bytes-to-text/308566>\
**Category:** flash\
**Created:** [April 26, 2010, 2:58am UTC](https://forum.kirupa.com/t/bytes-to-text/308566 "2010-04-26T02:58:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Someguynamedpie](https://avatars.discourse-cdn.com/v4/letter/s/b19c9b/32.png) [@Someguynamedpie](https://forum.kirupa.com/u/Someguynamedpie)\
**Post date:** [April 26, 2010, 2:58am UTC](https://forum.kirupa.com/t/bytes-to-text/308566/1 "2010-04-26T02:58:32Z")

</div>

I’m asking alot of questions lately eh?  
I can’t seem to make it work D:

```auto

public function ByteToText(Bytes:Number):String {
            var Kilobytes:Number = 0;
            var Megabytes:Number = 0;
            var Gigabytes:Number = 0;
            var Output:String = Bytes + " bytes";
            Kilobytes = Bytes / 1024
            Megabytes = Kilobytes / 1024
            Gigabytes = Megabytes / 1024
            if (Bytes > 1024) {
                Output = Math.round(Kilobytes) + " kilobytes, and " + Math.round(Bytes/1024) + " Bytes";
            }
            if (Kilobytes > 1024) {
                Output = Math.round(Megabytes) + " Megabytes, " + Kilobytes / Megabytes + " Kilobytes, and " + Bytes / Kilobytes + " Bytes";
            }
            if (Megabytes > 1024) {
                Output = Math.round(Gigabytes) + " Gigabytes, " + Megabytes / Gigabytes + " Megabytes, " + Kilobytes / Megabytes + " Kilobytes, and " + Bytes / Kilobytes;
            }
            return Output;
        }

```

The problem is when it says how many extra megabytes or kilobytes or bytes.  
Thanks if you help!
