Solved

Excel File Upload in VB.NET

Posted on 2009-06-30
5
583 Views
Last Modified: 2012-05-07
Hi,

Can I check if VB.NET's FileUpload function validates the content of an Excel file?

Because my IT guy told me that the Excel file that I've uploaded is not a proper Excel file although it is an *.xls, and the content when opening with a notepad looks like such:

<html xmlns:o="urn:schemas-microsoft-com:office:officexmlns:x="urn:schemas-microsoft-com:office:excelxmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=windows-1252"><meta name=ProgId content=Excel.Sheet><meta name=Generator content="Microsoft Excel 10"> . . . . . .
0
Comment
Question by:cukcuk
  • 2
  • 2
5 Comments
 
LVL 19

Assisted Solution

by:daveamour
daveamour earned 30 total points
ID: 24751683
It doesn't validate.
What version of Office are you using?
Newer versions I believe can save as xml so that may be an issue particularly if your colleague is trying to read it in an older version of Excel.
0
 

Author Comment

by:cukcuk
ID: 24751714
We're using Office 2003.

Opening the Excel using File - Open is not an issue.

Just that we are developing a web application to upload Excel files. So I'm wondering if the FileUpload do any kind of content validation at client or server side.
0
 
LVL 18

Accepted Solution

by:
Ajay Sharma earned 70 total points
ID: 24751846
As you said you are using Office 2003, and the file information states that it's an version 10 (which is Office 2002), which means there should not be any version compatibility issue.

Regarding the FileUpload control, it can only check the extension of file, and it can't validate the file content.
0
 

Author Comment

by:cukcuk
ID: 24759638
Oh.. is there any way for a function to validate an Excel file content in that case?

Thanks..
0
 
LVL 18

Expert Comment

by:Ajay Sharma
ID: 24760805
The file can be validated only by the IT guy.
Ask him to write a code which will do the following:
1) first step, upload the file.
2) After uploading, open the file using code and look for  columns and sheets according to your business logic.
3) If the above condition is satisfied then your file format is ok, Else its in bad format.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

770 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