Click here to Skip to main content
13,355,335 members (72,740 online)
Rate this:
Please Sign up or sign in to vote.
See more:

I'm doing Excel Data Upload into SQL DB, for this i'm doing all the stuff, it's working fine for me also...

Now , my question is whenever i upload the different excel file's , i want to save any excel having a unique name...


I'm try to upload A.xls,B.xls..., but the file should be saved in folder as xxx.xls.

this is the code for saving the excel

FileName = Path.GetFileName(FileUpload1.PostedFile.FileName);
string Extension = Path.GetExtension(FileUpload1.PostedFile.FileName);
string FolderPath = ConfigurationManager.AppSettings["DMSFolder"];
FilePath = Server.MapPath(FolderPath + FileName);
ViewState["FilePath"] = FilePath;
ViewState["FileName"] = FileName;

How to achieve this ....

But one more thing after save the file i want to display the available sheets in that excel . so, whatever we implement for that it's wont effect to existing ...

can any body give me some suggestion...

Thanks in Advance....
Posted 6-Feb-13 0:26am
Updated 6-Feb-13 1:11am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You could go ahead and add date and time (or a serial number) to make the file name unique.
A GUID[^] would be the most unique item (but I guess that would be overkill for your requirement).
naveensenagasetti 6-Feb-13 6:09am
Sorry Abhinav i'm asking i upload any type of file name but i want to save the file name as xxx.xls. But one thing after save the file i displayed the sheet names available in that excel . If we change some thing in file name it wont effect on existing.
joe_j 6-Feb-13 7:11am
Could you please make the question more clear? Not quite clear about the requirement.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.180111.1 | Last Updated 6 Feb 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100