I am trying to read a file uploaded, parsing it to a byte array. But the problem is, it never gets read. When I debug it, the byte array will still have zero elements.
int FileLength = File1.PostedFile.ContentLength;
if (File1.PostedFile != null && File1.HasFile)
Stream fStream = File1.PostedFile.InputStream;
byte contents = new byte[fStream.Length];
<strong>File1.PostedFile.InputStream.Read(contents, 0, FileLength);</strong>
SPAttachmentCollection attachments = enquiry.Attachments;
Problem occurs at the InputStream.Read. Afte that line, when i point to contents, it';s still zero.
When I open the attachment in browser, it;s opened as a corrupt file or a red cross image.
View Complete Post