Solved

Uploading Large xlsx file

Posted on 2011-09-08
2
241 Views
Last Modified: 2012-05-12
Hi,

I have several pages where user upload excel files for importing records into a database.

I detect the format and open the connection string appropriately like this.

If FileUpload1.HasFile Then
                    strExt = Right(FileUpload1.FileName, (Len(FileUpload1.FileName) - InStrRev(FileUpload1.FileName, ".")) + 1)
                    If strExt = ".xls" Or strExt = ".xlsx" Then
                        Dim strLocalPath As String
                        strLocalPath = DLookUp("ParamValue", "tblSysParam", "ParamName = 'TempFileDir'")
                        txtPath.Text = strLocalPath
                        strFileName = ExactTimeString() & strExt
                        txtFile.Text = strFileName
                        FileUpload1.SaveAs(strLocalPath & strFileName)
                        If strExt = ".xls" Then
                            strC = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='" & strLocalPath & strFileName & "';Extended Properties=Excel 8.0"
                        ElseIf strExt = ".xlsx" Then
                            strC = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & strLocalPath & strFileName & "';Extended Properties=Excel 12.0"
                        End If
                        txtConn.Text = strC
                    Else
                        DisplayAlert("File of type " & strExt & " not permitted only .xls or .xlsx maybe uploaded.", Me.Page)
                        CleanUp()
                        Reset()
                        Exit Try
                    End If
                Else
                    DisplayAlert("No sample information detected.\n\nIf you believe this to be an error please contact your system administrator.", Me.Page)
                    CleanUp()
                    Reset()
                    Exit Try
                End If
                myConnection.ConnectionString = strC
                myConnection.Open()

Open in new window


I know my code can handle 2007 format as I have sucessfully uploaded some. However, when I upload a large file (30MB) I get the external table is not in correct format error.

What is really weird is if I upload the same file in excel 2003 format it works. So I know it is not the maxupload size that is the problem. I had read that the permissions of the temporaryinternbet files folder could be an issue but then why would it work with 2003?

If I remove a large portion of the data from the 2007 version of the file (leaving the number of columns in tact) the connection works so I must be hitting a size threshold but I can't figure out what setting I need to change.

I am totally stumped here. Can anyone help?

Ell
0
Comment
Question by:PrisonBroken
2 Comments
 
LVL 16

Accepted Solution

by:
Easwaran Paramasivam earned 500 total points
ID: 36521172
Create a custom HTTP module to track the progress of file upload and see where it stucks. Please go through below articles.

http://dotnetslackers.com/Community/blogs/haissam/archive/2008/09/12/upload-large-files-in-asp-net-using-httpmodule.aspx

http://aspnetresources.com/articles/dark_side_of_file_uploads

If the problem with file size then increase the file upload size: http://weblogs.asp.net/skoganti/archive/2004/02/22/78124.aspx
0
 
LVL 3

Author Comment

by:PrisonBroken
ID: 36597644
Sorry EaswaranP,

Been on holiday will try this and get back to you
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now