Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Uploading Large xlsx file

Posted on 2011-09-08
2
Medium Priority
?
248 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

719 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