I want to build a Rest Web Service (in .NET) to upload image file with other information like name, description, time etc.
So I have write this code:
[Route("SaveDocument")]
[HttpPost]
public HttpResponseMessage SaveDocument(Stream fileContents)
{
byte[] buffer = new byte[10000];
int bytesRead, totalBytesRead = 0;
do
{
bytesRead = fileContents.Read(buffer, 0, buffer.Length);
totalBytesRead += bytesRead;
} while (bytesRead > 0);
Console.WriteLine("Service: Received file {0} with {1} bytes", fileName, totalBytesRead);
}
I want pass file Base64 and I'm not able to do this.
Can we help me?