Solved

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

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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 …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

829 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