Adding an attachment error

1850
0
04-02-2014 06:12 PM
by Anonymous User
Not applicable
Original User: effortlesswebsllc

After upgrading my Silverlight application to v3.2 and to Server 10.2.1, the code I wrote to add attachments no longer works.

When I attempt to add an attachment, I am getting the following error: Cannot access a closed file.

            //create the open file dialog
            OpenFileDialog dialog = new OpenFileDialog()
            {
                Multiselect = false
            };

            //show the dialog
            bool? userClickedOK = dialog.ShowDialog();

            //if the user clicked ok, the load the map definition
            if (userClickedOK == true)
            {
                //updaet the applicatin's busy status
                Application.Current.IsBusy = true;

                using (FileStream fileStream = dialog.File.OpenRead())
                {
                    this.featureLayer.AddAttachment(this.result.Graphic, fileStream, dialog.File.Name, AddAttachment_completed, AddAttachment_failed);
                }
            }
Here is the stack trace...

at System.IO.__Error.FileNotOpen()\r\n   at System.IO.FileStream.Read(Byte[] array, Int32 offset, Int32 count)\r\n   at ESRI.ArcGIS.Client.WebRequest.<>c__DisplayClass56.<UploadImpl>b__51(IAsyncResult asynchronousResult)"
0 Kudos
0 Replies