how to receive the byteArray image and save the image to server? RRS feed

  • Question

  • Hi, all.  I stucked by the question how to receive the image passed from Flex HTTPService, and how to save the image received from client side to server. (I don't have a real server, I am using virtual directory as a server. that means I only need to save the image to any folder in the virtual directory). I have tried to find way to save the image to server, but the server side code seems not working. can any IT PRO help me out ? Thanks a lot. 
    my code is below:

    client side code: //I think for client side code should be fine, there is not error

    private function browseImageClicked():void
     var f:FileFilter = new FileFilter("PNG","*.png");
     private function onFileSelect(event:Event):void
     private function onFileComplete(event:Event):void
     var byArray:ByteArray = fileReference.data;
          var image:Image = new Image();
          var bmpData:BitmapData;
          bmpData = new BitmapData(48, 48, true, 0x00ffffff);
           var imageData:ByteArray = sdf.encode(bmpData);
            var encoder : Base64Encoder = new Base64Encoder();
                      var params:Object = { image_data: encoder.flush() };

    server side code: // cannot work, I cannot get the image byte array. seems not working. I don't know how to get  the byteArray from client side, and how to save it to virtual directory.
       Dim byteArray As Byte()
            Dim stream As System.IO.MemoryStream
            Dim img As Image
            stream = New System.IO.MemoryStream(bytearray)
            img = Image.FromStream(stream)
            img.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg)
    Thursday, July 30, 2009 3:39 AM