Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Uploading Large xlsx file

Posted on 2011-09-08
2
Medium Priority
?
250 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 2000 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

783 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