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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:54:21+00:00 2026-06-11T14:54:21+00:00

This is my first ActionScript 3 application. It is supposed to upload data to

  • 0

This is my first ActionScript 3 application. It is supposed to upload data to specific location, which should be the www root location – the location where upload.php resides.

After I run the ActionScript application, I can select the file and I can see that the data is being uploaded, but I can never find it.

Would you be so kind, please, and help me to understand what is going on, and how can I find the uploaded data? I checked both: temporary files location, and the target destination.

Here is the ActionScript code:

    package {
    import flash.display.Sprite;
    import flash.events.*;
    import flash.net.*;
    import flash.text.*;
    public class ch30ex2 extends Sprite {
        protected var fileRef:FileReference;
        protected var uploadButton:TestButton;
        protected var tf:TextField;
        protected const YOUR_UPLOAD_URL:String = "http://localhost/Saifa/www/upload.php";

        public function ch30ex2() {
            fileRef = new FileReference();
            fileRef.addEventListener(Event.SELECT, selectHandler);
            fileRef.addEventListener(Event.CANCEL, cancelHandler);
            fileRef.addEventListener(ProgressEvent.PROGRESS, progressHandler);
            fileRef.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
            fileRef.addEventListener(SecurityErrorEvent.SECURITY_ERROR, errorHandler);
            fileRef.addEventListener(Event.COMPLETE, completeHandler);

            var btn:TestButton;
            btn = new TestButton(100, 25, "Browse...");
            btn.addEventListener(MouseEvent.CLICK, function(event:Event):void {
                fileRef.browse();
            });
            btn.x = btn.y = 20;
            addChild(btn);

            uploadButton = btn = new TestButton(100, 25, "Upload");
            btn.addEventListener(MouseEvent.CLICK, function(event:Event):void {
                fileRef.upload(new URLRequest(YOUR_UPLOAD_URL));
            });
            btn.x = 20; btn.y = 55;
            addChild(btn);

            tf = new TextField();
            tf.defaultTextFormat = new TextFormat("_sans", 11, 0);
            tf.multiline = tf.wordWrap = true;
            tf.autoSize = TextFieldAutoSize.LEFT;
            tf.width = 300; tf.x = 130; tf.y = 58;
            addChild(tf);

            cancelHandler(null);
        }
        protected function selectHandler(event:Event):void {
            tf.text = fileRef.name;
            uploadButton.mouseEnabled = uploadButton.tabEnabled = true;
            uploadButton.alpha = 1;
        }
        protected function cancelHandler(event:Event):void {
            tf.text = "";
            uploadButton.mouseEnabled = uploadButton.tabEnabled = false;
            uploadButton.alpha = 0.3;
        }
        protected function progressHandler(event:ProgressEvent):void {
            tf.text = "Uploading " + 
                event.bytesLoaded + " / " + event.bytesTotal + "bytes ...";
        }
        protected function errorHandler(event:ErrorEvent):void {
            tf.text = event.text;
        }
        protected function completeHandler(event:Event):void {
            tf.text = "Upload complete!";
        }
    }
}
import flash.display.*;
import flash.text.*;
class TestButton extends Sprite {
    public var label:TextField;
    public function TestButton(w:Number, h:Number, labelText:String) {
        graphics.lineStyle(0.5, 0, 0, true);
        graphics.beginFill(0xa0a0a0);
        graphics.drawRoundRect(0, 0, w, h, 8);
        label = new TextField();
        addChild(label);
        label.defaultTextFormat = new TextFormat("_sans", 11, 0, true, false,
            false, null, null, "center");
        label.width = w;
        label.height = h;
        label.text = labelText;
        label.y = (h - label.textHeight)/2 - 2;
        buttonMode = true;
        mouseChildren = false;
    }
}

and here is the PHP code, which is supposed to copy the temporary uploaded file:

<?php
move_uploaded_file($_FILES[‘Filedata’][‘tmp_name’], ‘./‘.time().$_FILES[‘Filedata’][‘name’]);
?>

All the code is from ActionScript Bible book

I would kindly like to ask for the following:

  • What can be the possible sources of my problem?
  • Looks my code correct? It gets compiled by FlashBuilder without problems
  • How can I identify source of my issue?
  • If you would have an example of working ActionScript + PHP application, I would be happy to see it.

As I spend hours after hours trying various things and combinations, I hope somebody might have had similar problem. Thank you.

  • 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-11T14:54:22+00:00Added an answer on June 11, 2026 at 2:54 pm

    In your PHP statement, there’s a weired quote ‘ instead of a simple quote '.

    <?php
    move_uploaded_file($_FILES['Filedata']['tmp_name'], './'.time().$_FILES['Filedata']['name']);
    ?>
    

    I tried with this and it worked fine.


    Also here’s the MXML i used to test:

    <?xml version="1.0" encoding="utf-8"?>
    <s:Application 
    minHeight="600"
    minWidth="955"
    creationComplete="application1_creationCompleteHandler(event)"
    xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:mx="library://ns.adobe.com/flex/mx">
    <fx:Script>
        <![CDATA[
            import mx.events.FlexEvent;
    
            import spark.components.Button;
            import spark.components.Label;
    
            protected function application1_creationCompleteHandler(event:FlexEvent):void {
                ch30ex2();
            }
    
            protected var fileRef:FileReference;
    
            protected var uploadButton:Button;
    
            protected var tf:Label;
    
            protected const YOUR_UPLOAD_URL:String = "http://127.0.0.1/test/test.php";
    
            public function ch30ex2():void {
                fileRef = new FileReference();
                fileRef.addEventListener(Event.SELECT, selectHandler);
                fileRef.addEventListener(Event.CANCEL, cancelHandler);
                fileRef.addEventListener(ProgressEvent.PROGRESS, progressHandler);
                fileRef.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
                fileRef.addEventListener(SecurityErrorEvent.SECURITY_ERROR, errorHandler);
                fileRef.addEventListener(Event.COMPLETE, completeHandler);
    
                var btn:Button;
                btn = new Button();
                btn.label = "Browse...";
                btn.addEventListener(MouseEvent.CLICK, function(event:Event):void {
                    fileRef.browse();
                });
                btn.x = btn.y = 20;
                addElement(btn);
    
                uploadButton = btn = new Button();
                btn.label = "Upload";
                btn.addEventListener(MouseEvent.CLICK, function(event:Event):void {
                    fileRef.upload(new URLRequest(YOUR_UPLOAD_URL));
                });
                btn.x = 20;
                btn.y = 55;
                addElement(btn);
    
                tf = new Label();
                tf.width = 300;
                tf.x = 130;
                tf.y = 58;
                addElement(tf);
    
                cancelHandler(null);
            }
    
            protected function selectHandler(event:Event):void {
                tf.text = fileRef.name;
                uploadButton.mouseEnabled = uploadButton.tabEnabled = true;
                uploadButton.alpha = 1;
            }
    
            protected function cancelHandler(event:Event):void {
                tf.text = "";
                uploadButton.mouseEnabled = uploadButton.tabEnabled = false;
                uploadButton.alpha = 0.3;
            }
    
            protected function progressHandler(event:ProgressEvent):void {
                tf.text = "Uploading " + event.bytesLoaded + " / " + event.bytesTotal + "bytes ...";
            }
    
            protected function errorHandler(event:ErrorEvent):void {
                tf.text = event.text;
            }
    
            protected function completeHandler(event:Event):void {
                tf.text = "Upload complete!";
            }
        ]]>
    </fx:Script>
    <fx:Declarations>
        <!-- Placer ici les éléments non visuels (services et objets de valeur, par exemple). -->
    </fx:Declarations>
    </s:Application>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm doing an Image Cache following this method: http://www.brandondement.com/blog/2009/08/18/creating-an-image-cache-with-actionscript-3/ I copied the two as
This is my first time using recursion in actionscript so I'm sure that there
i have used this code in my index.php to get user facebook first name
This question is specific to Adobe AIR ActionScript/Flash applications. I've spend quite some time
Say this is my autocompletion array: Pascal PHP Lua JavaScript ActionScript Active Server Pages
this is my first post.. so I'm learning Android & Java (coming from Actionscript),
This first bit works: $my_id = 617; $post_id_7 = get_post($my_id); $title = $post_id_7->post_excerpt; echo
i have two arrays like this first array Array ( [0228] => Array (
Using Dozer to map two objects, I have: /** /* This first class uses
How to create in-app step by step instructions? Like this ( first boot android

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.