Click here to Skip to main content
15,913,610 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am uploading an excel file (xls or xlsx format) and converting it into bytestream and storing it in oracle in BLOB field.

Upload code:

VB
If Path.GetExtension(fupDocuments.FileName) = ".xls" Then
                            contentType = "application/vnd.ms-excel"
                        ElseIf Path.GetExtension(fupDocuments.FileName) = ".xlsx" Then
                            contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
                        End If


At the time of download, download completed successfully. But file gets corrupted. Following is the download code:

VB
Response.ContentType = "Application/ms-excel"
                    Response.AddHeader("content-disposition", "attachment; filename=WYCFIS_Excel_Template.xls")


Please suggest. I do not want to add a column for content type in database.
Posted
Comments
navin ks 20-May-13 6:52am    
instead addheader use appendheader
Mahesh Bailwal 20-May-13 7:19am    
are you using Response.BinaryWrite for downloading?
Can you also share whole code for downloading.
meenalkk 20-May-13 7:20am    
Yes. I am using Response.BinaryWrite. Sorry, I cannot share the whole code. It is under NDA.
Mahesh Bailwal 20-May-13 7:32am    
can you please save this file instead downloading to your local machine and than open it,just make sure that file is uploaded correct.
meenalkk 20-May-13 7:38am    
It gives Open/Save options to the user.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900