0 Replies Latest reply on May 19, 2011 9:12 PM by ice9_us

    file upload to web server

    ice9_us Level 1

      I need a little help with the file upload process in flex..


      I am trying to upload a file.. i had it where i would get a cgi-script url passing as the following


      filename="filename"&filedata="data of the file"


      then my cgi script "written in C" would read from standard in.. and write the info to a file...

      now i get the following..



      Content-Disposition: form-data; name="Filename"

      Botanical Garden 239.JPG
      Content-Disposition: form-data; name="Filedata"; filename="Botanical Garden 239.JPG"
      Content-Type: application/octet-stream



      in the file i am trying to write.... Can anyone help me fix this problem? I am clueless at this point on what to do..

      sample code below is what i got from trying to work this...

      Thanks in advanced for anyones help..








      const FILE_UPLOAD_URL:String = "";



      private function init():void {

      fileRef =

      new FileReference();

      fileRef.addEventListener(Event.SELECT, fileRef_select);

      fileRef.addEventListener(ProgressEvent.PROGRESS, fileRef_progress);

      fileRef.addEventListener(Event.COMPLETE, fileRef_complete);




      private function browseAndUpload():void {


      message.text =





      private function fileRef_select(evt:Event):void {


      try {

      message.text =

      "size (bytes): " + numberFormatter.format(fileRef.size);


      new URLRequest(FILE_UPLOAD_URL) );


      trace("going to print file data in a sec... ready?");




      trace(fileRef.name );


      catch (err:Error) {

      message.text =

      "ERROR: zero-byte file";





      private function fileRef_progress(evt:ProgressEvent):void {

      progressBar.visible =





      private function fileRef_complete(evt:Event):void {

      message.text +=

      " (complete)";

      progressBar.visible =