I have a .NEt web service that takes a bytearray and writes it out to
a file.

<WebMethod()> _
    Public Function ProcessRequest(ByVal f() As Byte, ByVal filename
As String) As String
         Try

            ' instance a memory stream and pass the byte array
            ' to its constructor
            Dim ms As New MemoryStream(f)

            ' instance a filestream pointing to the
            ' storatge folder, use the original file name
            ' to name the resulting file
            Dim fs As New FileStream
(System.Web.Hosting.HostingEnvironment.MapPath("~/images/") &
filename, FileMode.Create)

            ms.WriteTo(fs)

            ' clean up
            ms.Close()
            fs.Close()
            fs.Dispose()

            ' return OK if we made it to here
            Return "OK"

        Catch ex As Exception

            Return ex.Message.ToString()

        End Try

    End Function

This works fine in a aspx web page but I want to use it in a flex
application. I can add the service to my application:

mx:WebService id="UploadService" wsdl="http://
fileuploader.cityofencinitas.org/?WSDL" result="__completeHandler
(event)" fault="__faultHandler(event)" useProxy="false">
        mx:operation name="ProcessRequest" >
                <mx:request>
                f>
                        {uploadByteArray}
                /f>
                fileName>
                        {txtFileName.text}
                /fileName>
                /mx:request>
        /mx:operation>
  /mx:WebService>



I I use it like this:

        uploadByteArray = new ByteArray;
        jpg = new JPEGEncoder(75);
        var bitmapData:BitmapData = new BitmapData
(uploadimage.width,uploadimage.height);
        bitmapData.draw(uploadimage);
        var quality:int = 75;
                uploadByteArray = jpg.encode(bitmapData );

                UploadService.ProcessRequest.send


Unfortunately nothing happens. No error messages and no file is
uploaded to the server. Can anybody help me figure out what is going
wrong?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to