Solved

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

Posted on 2006-10-20
3
752 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 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

Suggested Solutions

Title # Comments Views Activity
Add a Condition in ASP Repeater 6 59
VB.NET Textbox input validation 4 74
How to filter by key press ? 6 65
ASP.NET generate check digit for ITF-14 and EAN-13 barcodes 4 32
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

739 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