U r taking the file stream :( rather use the Bitmap class and assign its data to the array(bytearray) and then save it to disk. It should work.
2009/8/18 kumar <kumargandh...@gmail.com> > > Hi, > > Using VB ??, i dont know, i did it using some PHP code it worked > beautifully.Let me know if you need code in PHP. > > regards, > kumar. > > On Aug 17, 7:32 pm, LDaneil <leilin4...@hotmail.com> wrote: > > hi,Ranji, thanks a lot for your reply. > > > > your way seems working, but still have some problems on save the image > > received to a folder of disk. The image I saved is not a valid image. > > can you help me to check it again. Thank you in advance. > > > > this is my code : > > > > Dim binaryData() As Byte = > > System.Web.HttpContext.Current.Request.BinaryRead > > (System.Web.HttpContext.Current.Request.TotalBytes) > > System.Web.HttpContext.Current.Response.ContentType = > > "applicaiton/image" > > System.Web.HttpContext.Current.Response.AddHeader("Content- > > Length(", binaryData.Length.ToString()) > > Dim path As String = "c:\temp\Test.jpg" > > > > ' Delete the file if it exists. > > If File.Exists(path) Then > > File.Delete(path) > > End If > > 'Create the file. > > Dim fs As FileStream = File.Create(path) > > For i As Integer = 0 To binaryData.Length - 1 > > fs.WriteByte(binaryData(i)) > > Next i > > > > fs.Close() > > > > System.Web.HttpContext.Current.Response.End() > > > > On Aug 13, 2:02 am, Ranjit <ranjit.s...@gmail.com> wrote: > > > > > > > > > Hi, > > > > > some thing like this will solve ur problem > > > > > byte[] data = System.Web.HttpContext.Current.Request.BinaryRead > > > (System.Web.HttpContext.Current.Request.TotalBytes); > > > > > System.Web.HttpContext.Current.Response.ContentType = > > > "application/image"; > > > System.Web.HttpContext.Current.Response.AddHeader("Content- > > > Length", data.Length.ToString()); > > > System.Web.HttpContext.Current.Response.AddHeader("Content- > > > disposition", method + "; filename=" + name); > > > System.Web.HttpContext.Current.Response.BinaryWrite(data); > > > System.Web.HttpContext.Current.Response.End(); > > > > > Regards, > > > Ranjit sail > > > > > On Jul 30, 6:21 am, LDaneil <leilin4...@hotmail.com> wrote: > > > > > > Hi,all. I want to send aimagetoserverside using HTTPService, I am > > > > using ASP.NET forserverside coding. I don't know how to writeserver > > > > side code to receive theimagesent as a byteArray, and I am also not > > > > sure if my client side code is correct or not。is there any IT PRO who > > > > could help me ? Thanks in advance. > > > > > > client side code: > > > > > > private function browseImageClicked():void > > > > { > > > > var f:FileFilter = new FileFilter("PNG","*.png"); > > > > fileReference.browse([f]); > > > > fileReference.addEventListener(Event.SELECT,onFileSelect); > > > > fileReference.addEventListener(Event.COMPLETE,onFileComplete); > > > > } > > > > private function onFileSelect(event:Event):void > > > > { > > > > fileReference.load(); > > > > } > > > > private function onFileComplete(event:Event):void > > > > { > > > > var byArray:ByteArray = fileReference.data; > > > > varimage:Image= newImage(); > > > >image.source=byArray; > > > > var bmpData:BitmapData; > > > > bmpData = new BitmapData(48, 48, true, 0x00ffffff); > > > > bmpData.draw(image); > > > > > > var imageData:ByteArray = sdf.encode(bmpData); > > > > var encoder : Base64Encoder = new Base64Encoder(); > > > > encoder.encodeBytes(imageData); > > > > var params:Object = { image_data: encoder.flush() }; > > > > imageSend.send(params); > > > > > > }- Hide quoted text - > > > > > - Show quoted text -- Hide quoted text - > > > > - Show quoted text - > > > -- ---------------------------------------------------- Hissam, Flex Developer, Vantage Labs, Singapore-088806 (M)+65 90852194 --------------------------------------------------- Sent from Singapore --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to flex_india@googlegroups.com To unsubscribe from this group, send email to flex_india+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/flex_india?hl=en -~----------~----~----~----~------~----~------~--~---