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

x
?
Solved

uploading a csv file in asp.net c# to a folder in network

Posted on 2006-10-20
3
Medium Priority
?
757 Views
Last Modified: 2008-02-01
Could anybody help me with code, how can i upload a comma separated text file to a folder in network.

I want to achieve this using asp.net c#.

its urgent.

Thanks
0
Comment
Question by:r_pat72
3 Comments
 
LVL 10

Accepted Solution

by:
jnhorst earned 2000 total points
ID: 17777262
Add the following to your aspx page:

<input type="file" id="fileUpload" runat="server" />

This will show the usual file upload utility in your web page.  Add another server control button somewhere on the page and then code the click event as follows:

// get filename and map to a target folder in your web app.
string targetFile = Path.GetFileName(fileUpload.PostedFile.FileName);
targetFile = Server.MapPath("targetFolder/", targetFile);

// save the file.
fileUpload.PostedFile.SaveAs(targetFile);

// move to somewhere else on the network.
File.Move(targetFile, String.Concat("x:\somepath\", Path.GetFileName(targetFile)));

// delete from the web site.
File.Delete(targetFile);

John

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

916 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