N
Neo
Hello:
I am receiving a Binary File in a Request from a application. The
stream which comes to me has the boundary (Something like
"---------------------------390C0F3E0099" without the quotes), and also
some more text like this and file name (e.g. "Content-Disposition:
form-data; name="upload_file"; filename="C:\testing\myfile.dat"
Content-Type: application/octet-stream")
The binary content starts after "application/octet-stream".
The end of the file is also a boundary.
I need to filter this content and only write the binary content to the
disk.
I know the boundary string from the Request Headers and also the file
size. I am reading the request into a byte array using the following
code -
<code>
int iLength = (int) Request.InputStream.Length;
byte[] byBuffer = new byte[iLength];
Request.InputStream.Read(byBuffer,0,iLength);
</code>
Then i am using a filestream object to write the buffer to disk.
I dont know how to filter/replace the binary content. I tried to
convert it into a String object, but the file sizes are more than 2 MB,
and i dont want the string object to hold os much data.
Can someone please suggest any method of replacing some text in a
Binary content. I want to remove the boundary text from the stream.
Regards
Sunil Jambekar
I am receiving a Binary File in a Request from a application. The
stream which comes to me has the boundary (Something like
"---------------------------390C0F3E0099" without the quotes), and also
some more text like this and file name (e.g. "Content-Disposition:
form-data; name="upload_file"; filename="C:\testing\myfile.dat"
Content-Type: application/octet-stream")
The binary content starts after "application/octet-stream".
The end of the file is also a boundary.
I need to filter this content and only write the binary content to the
disk.
I know the boundary string from the Request Headers and also the file
size. I am reading the request into a byte array using the following
code -
<code>
int iLength = (int) Request.InputStream.Length;
byte[] byBuffer = new byte[iLength];
Request.InputStream.Read(byBuffer,0,iLength);
</code>
Then i am using a filestream object to write the buffer to disk.
I dont know how to filter/replace the binary content. I tried to
convert it into a String object, but the file sizes are more than 2 MB,
and i dont want the string object to hold os much data.
Can someone please suggest any method of replacing some text in a
Binary content. I want to remove the boundary text from the stream.
Regards
Sunil Jambekar