Uploading Files to Server Using AMFPHP


hey everyone. i'm trying build application allows user upload jpg files. i'm using amfphp , trying send bytearray php service file. keep getting following errors:

 

severity , description     path     resource     location     creation time     id
1061: call possibly undefined method load through reference static type flash.net:filereference.     multigallery/src     multigallery.mxml     line 86     1271268938265     99

severity , description     path     resource     location     creation time     id
1119: access of possibly undefined property data through reference static type flash.net:filereference.     multigallery/src     multigallery.mxml     line 93     1271268938266     100

 

these lines of code generating errors:

 

private function loadfile(e:event):void

          {

               file.addeventlistener.(event.complete, uploadfilecomplete);

               file.addeventlistener(progressevent.progress, onuploadprogress);

               file.load();

          }

          

          private function uploadfilecomplete(e:event):void

          {

               var fileref:filereference = e.target filereference;

               var filename:string;     

               bytedata = fileref.data;

               filename = fileref.name;

          }

any suggestions please?

 

thanks in advance!

hi,

 

i use amfphp , i'm not greatest of php developers these routines used send image byte array server,

 

declaration remote objects

 

<mx:remoteobject id="catalog" fault="onfault(event)" showbusycursor="true" source="qiksales" destination="amfphp">

        <mx:method name="uploadimage" result="qryupimage(event)" />

        <mx:method name="downloadimage" result="qrydownimage(event)" />

</mx:remoteobject>

 

 

this routine takes displayobect(edited image) gets bitmap data/compresses bytearray(can jpg/png) sends through remote object call php function

 

private function saveimage() : void

{

        var bmp : bitmap = new bitmap(bitmap(myimage.content).bitmapdata.clone());

try    

{

tmpimg = pngencoder.encode(bmp.bitmapdata);

}

finally

{

catalog.uploadimage(tmpimg);

}

}

 

 

the php function save bytearray sqldatabase

 

function uploadimage($ba) {

$data = $ba->data;

$mysql = mysql_connect(localhost,"root","");

$data = mysql_real_escape_string($data);

mysql_select_db( "catalog" );

$query = "insert images (id,data) values(0,'$data')";

$result = mysql_query( $query );

return $result;

}

not sure if helpful it's 1 way of getting image server.
david



More discussions in Flex (Read Only)


adobe

Comments

Popular posts from this blog

Joomla site hacked, cant see front and - Joomla! Forum - community, help and support

Christian Home School Programs - Joomla! Forum - community, help and support

Trouble with PF_OutFlag_I_USE_AUDIO and PF_CHECKOUT_LAYER_AUDIO