예제 #1
0
        protected void editImg_Click(object sender, EventArgs e)
        {
            HttpChannel chnl = new HttpChannel();

            try
            {
                ChannelServices.RegisterChannel(chnl, false);
            }
            catch (RemotingException ex)
            {
                //all good, nobody cares, but we log it
            }
            mgr = (INewsManager)Activator.GetObject(typeof(INewsManager), "http://localhost:1234/NewsManager.soap");
            News newsObj = new News();

            newsObj.id   = Convert.ToInt32(hiddenID.Value);
            newsObj.date = DateTime.Now;
            byte[] imgarray = null;
            if (photo.HasFile)
            {
                int imagefilelenth = photo.PostedFile.ContentLength;
                imgarray = new byte[imagefilelenth];
                System.IO.BinaryReader br = new BinaryReader(photo.PostedFile.InputStream);
                imgarray = br.ReadBytes(photo.PostedFile.ContentLength);
            }
            newsObj.photo = imgarray;
            mgr.updateNewsPhoto(newsObj);
        }