Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8467667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:42:40+00:00 2026-06-10T15:42:40+00:00

I am trying to upload file to server with the FileReference class. the file

  • 0

I am trying to upload file to server with the FileReference class.
the file is mp3 that was encoded in runtime without saving him on the local hard drive.

Is it possible to fit in the mp3Encoder into the FileReference somehow?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T15:42:41+00:00Added an answer on June 10, 2026 at 3:42 pm

    Assuming you have the mp3 as a ByteArray (not sure how else it would exist at runtime if you haven’t saved it to disk), you can use the URLLoader class, like this:

    var scriptRequest:URLRequest = new URLRequest("PATH_TO_YOUR_UPLOAD_SCRIPT");
    var scriptLoader:URLLoader = new URLLoader();
    var scriptVars:URLVariables = new URLVariables();
    
    scriptLoader.addEventListener(Event.COMPLETE, handleLoadSuccessful);
    scriptLoader.addEventListener(IOErrorEvent.IO_ERROR, handleLoadError);
    
    scriptVars.var1 = MP3_AS_BYTE_ARRAY;
    
    scriptRequest.method = URLRequestMethod.POST;
    scriptRequest.data = scriptVars;
    
    scriptLoader.load(scriptRequest);
    
    function handleLoadSuccessful($evt:Event):void
    {
        trace("Message sent.");
    }
    
    function handleLoadError($evt:IOErrorEvent):void
    {
        trace("Message failed.");
    }
    

    Then on the server, you just need to save the stream to a file and give it the correct mp3 mime type.

    There’s a decent tutorial, from which this example is adapted, here: http://evolve.reintroducing.com/2008/01/27/as2-to-as3/as2-%E2%86%92-as3-loadvars-as3-equivalent/

    And if you need to send your request as multipart/form-data (so it appears to be an attached file), there’s a good example of this here: http://marstonstudio.com/2007/10/19/how-to-take-a-snapshot-of-a-flash-movie-and-automatically-upload-the-jpg-to-a-server-in-three-easy-steps/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to do a file upload in Flex using it's FileReference class. This
i am trying to upload a mp3 file to server using php code as
I am trying to upload file to an sharepoint online server using webclient. Up
I'm trying to upload a file to the server using a HTTP multipart form
In a prior post I was trying to upload a file to a server
I'm trying to upload a file to an FTP server using code based on
I'm trying to upload a file to a distant server, but looks like the
Hi all i was trying to upload a pdf file to my php server
friends, i am trying to upload file to php server using following tutorial http://getablogger.blogspot.com/2008/01/android-how-to-post-file-to-php-server.html
I'm trying to upload a file to my server using the CakePHP file upload

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.