View Single Post
  #14 (permalink)  
Old 09-01-2007, 04:13 AM
S.Vinothkumar S.Vinothkumar is offline
D-Web Genius
 
Join Date: May 2007
Posts: 1,061
S.Vinothkumar is on a distinguished road
Wink Re: WebServices in DotNet

Hey Ramesh,

We can upload any type of file with using the upload method which is I posted in last post.

For that you have to send the image file as a byte array. You can use the following code for converting the image in to byte[] in C#.

Here I'm using the UploadFile control for browse the image file.

Code:
using System.IO;
Stream imgStream = UploadFile.PostedFile.InputStream;
int imgLen = UploadFile.PostedFile.ContentLength;
string imgContentType = UploadFile.PostedFile.ContentType;
byte[] imgBinaryData = new byte[imgLen];
int n = imgStream.Read(imgBinaryData, 0, imgLen);
That's it....
__________________
S.VinothkumaR
Behind me is infinite power,
Before me is Endless Possibility,
Around me is Boundless Opportunity,
Why should I fear!
Reply With Quote