I currently upload document to SharePoint 2010 document library using ASP FileUpload control.
The process works fine for OFfice 92-2003 documents, TXT, RTF and even PDF until it meets Office 2010 documents.
The problem is: You can upload the file successfully. The file is there on the SharePoint server. But after downloading to local, open the file will show that the file has unreadable content (or corrupt) and need to recover to read. After recovering, it opens normally.
I recall reading somewhere that Office 2010 documents uploading stream is slightly different from Office 2003 but don't remember how it exactly is.
This is my code:
ASPX
<asp:FileUpload ID="UploadControl" runat="server" onchange="FileChooseAction()" />
Code Behind
Dim byt As Byte()
ReDim byt(UploadControl.PostedFile.InputStream.Length)
UploadControl.PostedFile.InputStream.Seek(0, SeekOrigin.Begin)
UploadControl.PostedFile.InputStream.Read(byt, 0, UploadControl.PostedFile.InputStream.Length)
UploadControl.PostedFile.InputStream.Close()