I am reading data from an IPhone App that uses http POST to transfer the image to the Server I can read this into a an binary and it does write to a file (See below) the issue I have is when I open the image it fails.
You can see the code from the Iphone on this post:
asp http POST Read Data
Code:
byte[] buffer = new byte[Request.ContentLength];
using (BinaryReader br = new BinaryReader(Request.InputStream))
br.Read(buffer, 0, buffer.Length);
string fileName = @"C:\test\test.jpg";
FileStream fs = new FileStream(fileName, FileMode.Create,
FileAccess.ReadWrite);
BinaryWriter bw = new BinaryWriter(fs);
bw.Write(buffer);
bw.Close();
The image Content-Type is application/octet-stream
Can anyone shine any light onto this please.
Does the following work? For this it would probably be better to change the FileStream to a MemoryStream
Or
Full Example (using your example, but if you want to change how the binary data is read from the other post, that is fine too, just confinue from after you have the buffer):