Solved

Uploading Large xlsx file

Posted on 2011-09-08
2
243 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

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Call windows 10 virtual keyboard from windows forms app 2 52
SQL Help 27 57
Can't disable touch pad on Windows 10 computer 16 45
How to read text with RegEx... 2 25
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

837 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