?
Solved

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

Posted on 2006-10-20
3
Medium Priority
?
754 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
[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
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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

752 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