Hi i am making a web service that receive a file and save it on the server, i have made a method that takes byte array -buffer- and string -filename- then use Stream.Write() method to wsave it.
I have made a windows app that read a file into a byte array Stream.Read() then call the webservice method and pass the array and the filename. if the file was large i cannot read all of it into the byte array so i have made the byte array length only 3000 then looped the file and each time in the loop read a 3000 byte then pass it to the web service method:
byte[] buffer = new byte[3000];
while(stream.Read(buffer,0,buffer.Length) != 0)
{
myService.ServiceSendMethod(buffer , fileName);
}
now the problem is , if the file was say 70 MB, then it will be a looooooooong loop and each time in the loop i am calling a webserive method which takes a time to be called, so time is too long to send it, furthermore the application is freezed until the file is sent.
So plz can anyone help me find the best way and more efficient?
No one has replied yet! Why not be the first?
Sign in or Join us (it's free).