Question

Im trying to upload a file through a SOAP request , and it worked perfectly , but I couldnt get a progress for the uploaded amount of the request .

Was it helpful?

Solution 2

I can answer my question now,

Im not using SOAP anymore to upload my files in my solution, Im using HTTPWebRequest now,

1) yes im uploading my large files in chunks (each chuck is 1MB), 2) each chunk(1 MB) can give me progress each BufferSize (4 KB in my case);

so there is a big loop, foreach(Chunk in File) {} .

and inside the big loop there is another loop, as Im using HTTPWebRequest:

long buffer = 4096;
Stream stm = request.GetRequestStream();
while (remainingOfChunkWithReq != 0)
{
  stm.Write(buffer, 0, bytesRead);
  remainingOfChunkWithReq = remainingOfChunkWithReq - bytesRead;
  bytesRead = memoryStream.Read(buffer, 0, bytesSize);
  //Send Progress
}

then continue to send the request. and receive the response.

OTHER TIPS

You could try sending the file up in "chunks", like 1MB at a time rather than sending it all up at once? That way when each chunk completes, you'll be able to update the progress.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top