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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:28:20+00:00 2026-06-14T15:28:20+00:00

I have a button in flash as3 that uses a class to upload an

  • 0

I have a button in flash as3 that uses a class to upload an image and then display it on the main movie.

I have a herarchy:

  • http://www.MYSITE.com/test/
  • http://www.MYSITE.com/test/uploads/
  • http://www.MYSITE.com/test/uploads/images/

and a file called image.php
in http://www.MYSITE.com/test/uploads/image.php

<?PHP
$target_path = $_REQUEST[ 'path' ];
$target_path = $target_path . basename( $_FILES[ 'Filedata' ][ 'name' ] ); 

if ( move_uploaded_file( $_FILES[ 'Filedata' ][ 'tmp_name' ], $target_path ) ) 
{
     echo "The file " . basename( $_FILES[ 'Filedata' ][ 'name' ] ) . " has been uploaded;";
} 
else
{
     echo "There was an error uploading the file, please try again!";
}
?>

The as is:

package 
{
    import flash.display.*;
    import flash.events.*;
    import flash.text.*;
    import flash.geom.*;
    import flash.utils.*;
    import flash.net.*;
    import flash.system.*;

    import src.events.*;
    import src.image.*;
    import src.file.*;
    import src.load.*;
    import src.ui.*;
    import com.senocular.display.transform.*

    public class ImageUploader extends Sprite 
    {
        private var m_basePath  : String = 'http://www.MYSITE.com/test/';           // web server path
        private var m_uploadPath : String = 'uploads/';                                                 // folder on server where you will allow images to be uploaded it has folder permissions  set to 777 );
        private var m_outputPath : String = 'output/';                                                  // folder on server where images should be created; folder permissions are set to 777 );

        public function ImageUploader () 
        {
            // allow script access;
            Security.allowDomain( 'http://www.MYSITE.com/test' );           
            Security.allowInsecureDomain( 'http://www.MYSITE.com/test' );   

        // determine whether the swf is being accessed from the web orlocal hard drive;
            m_isLocal = false;

            init();
        }

        // display items;
        public var upload : UIButton;                       // upload button on .fla stage;

        // output container;
        private var m_output : Sprite = new Sprite();       // container for image;
        private var m_mask : Sprite = new Sprite();         // mask for image container;
        private var m_progress : Sprite = new Sprite();     // upload / download indicator;
        private var m_effect : Scribble;                    // covers image with random effect;

        // vars;
        private var m_isLocal : Boolean;                    // determines if swf is on web server or local drive;
        private var m_fileMgr : FileManager;                // manages the opening & upload of local files;
        private var m_imagePHP : String = 'image.php';      // file that will manage image upload on your server;
        private var m_finalImage : String;                  // final name of file on creation;
        private var m_imageQuality : Number = 90;           // jpeg or png export quality;
        private var m_capture : Sprite;                     // set this equal to the sprite or movie clip that you wish to capture ( set to stage for entire movie );
        private var m_downloader : GraphicLoader;           // handles image download ( after upload is complete );
        private var m_imageExtension : String = '.jpg';     // jpeg image extension;

//      returns upload php file path based on whether or not the swf is a local publish or hosted on a web server;  
        public function get uploadPath () : String
        {
            return m_basePath + m_imagePHP;
        }

//      returns image creation php file path based on whether or not the swf is a local publish or hosted on a web server;  
        public function get createPath () : String
        {
            return m_basePath + m_imagePHP;
        }

        //returns image creation php file path based on whether or not the swf is a local publish or hosted on a web server;    
        public function get downloadPath () : String
        {
            return m_basePath + m_uploadPath;
        }

        //returns image creation php file path based on whether or not the swf is a local publish or hosted on a web server;    
        public function get finalImagePath () : String
        {
            return m_basePath + m_outputPath + m_finalImage + m_imageExtension;
        }

        //returns container for image capture container;
        public function get captureContainer () : Sprite
        {
            return m_capture;
        }

        //sets container for image capture container;
        public function set captureContainer ( inContainer : Sprite ) : void
        {
            m_capture = inContainer;
        }

        //  browse for image files on click of upload button;   
        private function onBrowse ( e : MouseEvent ) : void
        {
            m_fileMgr.browse();
        }

        //track image upload progress;
        private function onUploadProgress ( e : CustomEvent ) : void
        {
            trace( 'image uploading : ' + e.params.percent );

            m_progress.scaleX = e.params.percent;
        }

        //fires when image upload is complete;      
        private function onImageUploaded ( e : CustomEvent ) : void
        {           
            var dPath : String = String( downloadPath + e.params.fileName );

            trace( 'image ready for download at : ' + dPath );

            m_downloader.loadURL( dPath );
        }

        //track image download progress;        
        private function onDownloadProgress ( e : CustomEvent ) : void
        {
            trace( 'image downloading : ' + e.params.percent );

            m_progress.scaleX = 1 - e.params.percent;
        }

        //fires on image download is complete;      
        private function onImageDownloaded ( e : CustomEvent ) : void
        {
            trace( 'image downloaded' );

            // get image from loader;
            var clip : * = new Bitmap( e.params.loaded.bitmapData.clone() ) ;

            // add the image to the stage;
            MovieClip(parent).textAssets.text_front.txtMc.holder_clipart.x = 215;
            MovieClip(parent).textAssets.text_front.txtMc.holder_clipart.clipart.clipart_inside.inside.addChild(clip);

            if (MovieClip(parent).textAssets.text_front.txtMc.holder_clipart.clipart.clipart_inside.inside.numChildren > 0)
            {
                MovieClip(parent).textAssets.text_front.txtMc.holder_clipart.clipart.clipart_inside.inside.removeChildAt(0);
            }           

            clip.smoothing = true;

        }

        //fires if there is an error during upload;     
        private function onUploadError ( e : CustomEvent ) : void
        {
            trace( 'upload error' );
        }

        //fires if there is an error during download;       
        private function onDownloadError ( e : ErrorEvent ) : void
        {
            trace( 'download error' );
        }

        //downloads image to swf;
        private function onGetCapturedImage ( e : MouseEvent ) : void
        {
            m_fileMgr.download( finalImagePath, m_finalImage + m_imageExtension );
        }

        //  set up file manager / button listeners; 
        private function init () : void
        {           
            // add output container to stage at 0,0;
            addChildAt( m_output, 0 );

            // check to make sure stage is available ( which it wouldn't be if this class were instantiated from another class );
            if ( stage != null ) 
            {
                // set up stage;
                stage.align = StageAlign.TOP_LEFT;
                stage.scaleMode = StageScaleMode.NO_SCALE;

                // create image mask that matches the stage height & width;
                with ( m_mask.graphics )
                {
                    beginFill( 0x000000 );
                    drawRect( 0, 0, stage.stageWidth, stage.stageHeight );
                }
            }

            // create progress indicator;
            with ( m_progress.graphics )
            {
                beginFill( 0x000000 );
                drawRect( 0, 0, upload.width, 1 );
            }

            addChild( m_progress );

            m_progress.x = upload.x;
            m_progress.y = upload.y + upload.height + 2;

            // set container to use as image capture area;
            captureContainer = m_output;

            // set capture container mask;
            captureContainer.mask = m_mask;

            // add effect to image;
            m_effect = new Scribble();

            captureContainer.addChild( m_effect );

            // show upload / scribble buttons;
            upload.show();

            // set progress bar to zero scale;
            m_progress.scaleX = 0;

            // set up file manager;
            m_fileMgr = new FileManager( uploadPath, m_uploadPath );
            m_fileMgr.addEventListener( FileManager.ON_PROGRESS, onUploadProgress );
            m_fileMgr.addEventListener( FileManager.ON_UPLOAD_ERROR, onUploadError );
            m_fileMgr.addEventListener( FileManager.ON_IMAGE_UPLOADED, onImageUploaded );

            // listen to buttons;
            upload.addEventListener( MouseEvent.CLICK, onBrowse );

        // set up loader;
            m_downloader = new GraphicLoader();
            m_downloader.addEventListener( GraphicLoader.ON_LOAD_PROGRESS, onDownloadProgress );
            m_downloader.addEventListener( GraphicLoader.ON_LOAD_COMPLETE, onImageDownloaded );
            m_downloader.addEventListener( ErrorEvent.ERROR, onDownloadError );
        }

        //returns new string representing the month, day, hour, minute and millisecond of creation for use as the image name;   
        private function getUniqueName () : String
        {
            var d : Date = new Date();

            return d.getMonth() + 1 + '' + d.getDate() + '' + d.getHours() + '' + d.getMinutes() + ''  + d.getMilliseconds();
        }
    }
}

So whenever I try to upload any movie I get this in the Output of flash:

image uploading : 1
ERROR: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2038: I/O FILE ERROR. URL: http://www.MYSITE.com/test/image.php?path=uploads/"]

So I do not know where is the error, I have set the permissions to 777 to all the files involved…

  • 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-14T15:28:22+00:00Added an answer on June 14, 2026 at 3:28 pm

    You just give access right upload all in FTP filezilla to that upload folder where you want upload this file.i think there is no access right to files…

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

Sidebar

Related Questions

I have a Flash (AS3, CS3) piece that has a button that will make
I have a Flash AS3 application that uses FileReference.browse() to request a SWF from
I have an Movie Clip in Flash that have subobject of button type which
I have as3 class like this package { import Global; import flash.display.MovieClip; import flash.events.*;
I have a button that can have a focus css class associated with it
I have created a flash movie in AS3, I wanted to have a seek
Is it possible to convert a flash button that I have on my site
I have a php script that receives $_['post'] data from a button in flash
In AS3 flash - I have a textField with a CSS in it that
In my application i have an image button that basically switches on and off

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.