C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Interview   Jobs   Projects   Offshore Development    
Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Revenue Sharing | Talk to Us |



My Profile

Gifts

Active Members
TodayLast 7 Days more...







asp.net copy file


Posted Date: 08 Mar 2006      Total Responses: 1

Posted By: dotnet       Member Level: Gold     Points: 2


hi
i wanna kwno how to copy a file a partcular lcation
thanks in adavance
pervej munja





Responses

Author: MuniHemadriBabu.Jogi    09 Mar 2006Member Level: GoldRating:     Points: 2
Hi

html code:
<code>
<html>
3 <head>
4 <style TYPE="text/css">
5 body {
6 font-family: Verdana;
7 font-size: 70%;
8 }
9 table tr td {
10 font-family: Verdana;
11 font-size: 70%;
12 }
13 </style>
14 </head>
15
16 <body>
17 <h4>Copying a Directory with ASP.NET</h4>
18 <form runat="server">
19 <table border="0" cellpadding="3" cellspacing="2" bgcolor="#cccccc">
20 <tr>
21 <td>Type the source directory:</td>
22 <td><asp:TextBox Runat="server" ID="tbxSourceDir"></asp:TextBox></td>
23 </tr>
24 <tr>
25 <td>Type the destination directory:</td>
26 <td><asp:TextBox Runat="server" ID="tbxDestinationDir"></asp:TextBox></td>
27 </tr>
28 <tr>
29 <td colspan="2"><asp:Button Runat="server" ID="btnCopy" OnClick="Copy_Click" Text="Click to Copy"></asp:Button></td>
30 </tr>
31 </table>
32 <br>
33 <asp:Label Runat="server" ID="lblStatusMessage" Visible="False" ForeColor="#ff0000"></asp:Label>
34 </form>
35 </body>
36 </html>
</code>

button_Click code
<%@ Page Language="vb" debug="true" explicit="true" strict="true" %>
2 <script language="vb" runat="server">
3 Sub Copy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
4 'convert our source path into a physical path
5 Dim sourcePath As String = Server.MapPath(tbxSourceDir.Text)
6 'get the folder we want to copy from
7 Dim arrSourcePath() As String = RegEx.Split(tbxSourceDir.Text, "/")
8 Dim lastFolder As String = arrSourcePath(UBound(arrSourcePath))
9 'get our destination path as physical
10 Dim destPath As String = Server.MapPath(tbxDestinationDir.Text + "/" + lastFolder)
11 Try
12 CopyDirectory(sourcePath, destPath, True)
13 Catch exc As System.Exception
14 lblStatusMessage.Text = exc.Message
15 lblStatusMessage.Visible = True
16 End Try
17 End Sub


Post Reply
You must Sign In to post a response.
Previous : what is a resource file...
Return to Discussion Forum
Post New Message
Category: .NET

Related Messages



Read TATA Nano reviews.
dotNet Slackers   BizTalk Adaptors    Web Design   Scripts
Are you waiting for engineering entrance result? Watch here for engineering entrance results.
web conferencing services

Contact Us    Privacy Policy    Terms Of Use