Welcome Guest, Not a member yet? Register   Sign In
Send from .AS file to a codeigniter controllers function.
#1

[eluser]FnTm[/eluser]
Hi all!

Im completely bumed out about this, as i've been thinking how to get this done for the better part of today, and have come up with nothing.
So the situation:
I wanted a way to upload several images at once from a sing input field, so i scourged the web for an appropriate script, and came up with a promising one.
It uses Flash to select multiple files, then uses javascript to connect all of the functions from javascript to flash and back, then uses flash to call for a .php file to do the actuall uploading part. So what i am trying to figure out is, how to make it work with CI. And moreso with the image manipulation library. So i came up with an idea, that i should somehow make it call not a file, but a function instead. So i was wondering how to do this. Heres the code of the Upload.as file

P.S
Code:
public function UploadFiles
is the one with the url.


Code:
import flash.net.FileReferenceList;
import flash.net.FileReference;
import flash.external.ExternalInterface;

class nl.martijndekuijper.Upload extends FileReferenceList
{
    private var m_aFiles:Array = new Array();
    
    public function Upload() {
        this.addListener( this );
        
        ExternalInterface.addCallback( "selectFiles", this, browse );        
        ExternalInterface.addCallback( "uploadFiles", this, uploadFiles );
    }    
    
    public function onSelect( p_oFileReferenceList:FileReferenceList ):Void {
        this.m_aFiles = p_oFileReferenceList.fileList;
        
        var l_aFileNames:Array = new Array();
        for( var i:Number = 0; i < this.m_aFiles.length; i++ ) {
            this.m_aFiles[ i ][ "id" ] = i;
            l_aFileNames.push( this.m_aFiles[ i ] );
        }
        
        _root.sDebug = "Upload::onSelect()";
        
        ExternalInterface.call("upload.updateFiles", l_aFileNames );        
    }
    
    public function uploadFiles():Void {
        _root.sDebug = "Upload::upload()";
        
        for( var i:Number = 0; i < this.m_aFiles.length; i++ )
        {
            this.m_aFiles[ i ].addListener( this );
            if( !this.m_aFiles[i].upload( "../php/upload.php" ) )
                 _root.sDebug += "Er is een fout opgetreden!";
        }
    }
    
    private function onProgress( file:FileReference, bytesLoaded:Number, bytesTotal:Number ):Void {
        var l_iPercent:Number = ( bytesLoaded / bytesTotal * 100 );
        ExternalInterface.call("upload.updateProgress", file["id"], l_iPercent );
    }
}

Anyone? Please?




Theme © iAndrew 2016 - Forum software by © MyBB