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 8522235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:03:59+00:00 2026-06-11T07:03:59+00:00

With This code I upload selected Files . That works without problem and at

  • 0

With This code I upload selected Files . That works without problem and at after uploading file i want to send “uploadedFilelist” as json or string to Actionscript . the problem is i don`t know how can i pass this data to Actionscript and also i dont know how can i get this data in ActionScript . ( That is My firs experience with AS )

ActionScript Code :

package 
{
import flash.external.*;
import flash.net.FileReferenceList;
import flash.net.FileReference;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.system.Security;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.events.SecurityErrorEvent;
import flash.net.FileFilter;
import flash.net.URLRequest;
import flash.net.URLRequestMethod;
import flash.net.URLVariables;

public class MultiSelectClass extends MovieClip
{
    private var fileRefList:FileReferenceList=new FileReferenceList();
    private var myRequest:URLRequest; 
    private var serviceUrl:String ="";
    private var metaData:String="";

    function MultiSelectClass()
    {
        Security.allowDomain("*");

        fileRefList.addEventListener(Event.SELECT,selectHandler);
        fileRefList.addEventListener(Event.COMPLETE,completeHandler);
        myButton.addEventListener(MouseEvent.CLICK,myButtonClick);

        serviceUrl=ExternalInterface.call("MultiFileUploaderFunc.GetServiceUrl");
        myRequest = new URLRequest(serviceUrl);

        metaData = ExternalInterface.call("MultiFileUploaderFunc.GetMetdaData")         
    }

    function myButtonClick(ev:MouseEvent):void
    {
        var swfTypeFilter:FileFilter = new FileFilter("Text Files","*.txt; *.html;*.htm;*.php");
        var allTypeFilter:FileFilter = new FileFilter("All Files (*.*)","*.*");
        fileRefList.browse([swfTypeFilter,allTypeFilter]);
    }

    function selectHandler(e:Event):void
    {
        var vars:URLVariables = new URLVariables();
        myRequest.method = URLRequestMethod.POST;

        for each (var file:FileReference in fileRefList.fileList)
        {
            file.addEventListener(Event.COMPLETE, completeHandler);
            file.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
            file.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);

            vars.fileData = file.data;
            vars.metaData= metaData;
            myRequest.data = vars;

            file.upload( myRequest);
        }
    }

    function completeHandler(e:Event):void
    {                       
        ExternalInterface.call("alert","Ok!");
    }

    private function securityErrorHandler(event:SecurityErrorEvent):void
    {
        ExternalInterface.call("alert","Security Problem !");
    }

    private function ioErrorHandler(event:IOErrorEvent):void
    {
        ExternalInterface.call("alert","I/O Problem !");
    }
}
}

Generic Handler Code :

 public class Handler1 : IHttpHandler
 {

public void ProcessRequest(HttpContext context)
{
  if (context.Request.Params["metaData"] == string.Empty)
    return;

  var metaData = context.Request.Params["metaData"];

  var jss = new JavaScriptSerializer();

  var metadataDictionary = jss.Deserialize<dynamic>(metaData);

  var jsFileType = metadataDictionary["FileType"];

  var uploadedFilelist = new List<FileModel>();

  foreach (string file in context.Request.Files)
  {
    var httpFile = context.Request.Files[file];

    if (httpFile.ContentLength == 0)
      continue;

    string savedFileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory,   "Upload\\", Path.GetFileName(httpFile.FileName));
    httpFile.SaveAs(savedFileName);


    var uploadedFile = new FileModel
    {
      Extension = System.IO.Path.GetExtension(httpFile.FileName),
      Id = ID,
      MimeType = httpFile.ContentType,
      Name = httpFile.FileName,
      FileType = jsFileType
    };

    uploadedFilelist.Add(uploadedFile);
  }

  context.Response.ContentType = "application/json";
  context.Response.Write(jss.Serialize(uploadedFilelist));

}
  • 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-11T07:03:59+00:00Added an answer on June 11, 2026 at 7:03 am

    It’s rather simple. You just add DataEvent.UPLOAD_COMPLETE_DATA event listener and get data.

    fileReference.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA, uploadCompleteHandler);
    
    private function uploadCompleteHandler(event:DataEvent):void {
        trace(event.data); //response data
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a upload script that works with html5 file api and i want
I got this traceback when trying to upload a file using put_file (source code
This code is the core of a much larger script that works great in
I've got some Java Applet that I'd like to use to upload file/files to
I am working on an app that have this code on a view file
I am using this PHP code: if (isset($_GET['c'])) { $pages = array(home, upload, signup);
I have this part of code in my functions.php: function cc_admin_enqueue_scripts($hook) { $file_dir=get_bloginfo('template_directory'); wp_enqueue_script('media-upload');
This code below allows me to find the word error in all my files
HI I Try Upload a file in Silver-Light. for doing this I use System.IO.File
I have a file upload function in my asp.net mvc application that allows users

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.