Solved

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

Posted on 2006-10-20
3
739 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 500 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

762 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now