A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: ByteArray to FileReference

  1. #1
    Junior Member
    Join Date
    Nov 2011
    Posts
    7

    ByteArray to FileReference

    I know I can use this to save ByteArray data to disk:

    Actionscript Code:
    var ba:ByteArray = new ByteArray;
        ba.writeUTFBytes('<?xml version="1.0" encoding="iso-8859-1"?>\n'+text)
       
        var fr:FileReference = new FileReference(ba);
        fr.browse(new Array(new FileFilter("XML (*.xml)", "*.xml;")));
        fr.save( ba, 'ticker.xml' );

    ...But is it possible to use the upload() method to write the same ByteArray to a server?

    Actionscript Code:
    var request:URLRequest = new URLRequest("http://www.[domain].com/uploader_script.php")
           
            fr.upload(request);

    Thanks all.

  2. #2
    Dignitary rynoe's Avatar
    Join Date
    Jan 2003
    Location
    Earth
    Posts
    760
    Are you using the AIR framework?
    [SIGPIC][/SIGPIC]

  3. #3
    Junior Member
    Join Date
    Nov 2011
    Posts
    7
    It is a browser-based application using Flash Player.

  4. #4
    Dignitary rynoe's Avatar
    Join Date
    Jan 2003
    Location
    Earth
    Posts
    760
    The FileReference class provides a means to upload and download files between a user's computer and a server. An operating-system dialog box prompts the user to select a file to upload or a location for download. Each FileReference object refers to a single file on the user's disk and has properties that contain information about the file's size, type, name, creation date, modification date, and creator type (Macintosh only).

    Note: In Adobe AIR, the File class, which extends the FileReference class, provides more capabilities and has less security restrictions than the FileReference class.
    [SIGPIC][/SIGPIC]

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center