• 大小: 66KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-18
  • 语言: C#
  • 标签: web  ftp  

资源简介

asp.net 实现的 Web 版Ftp,可上传文件,文件删除,文件重命名,文本文件的编辑,创建文件夹, 删除文件夹等,通过web.config 可设置访问权限

资源截图

代码片段和文件信息

using System;
using System.Configuration;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.IO;

namespace YUFEIS.WebFtp
{
    public partial class _Default : Pagebase
    {
        protected string virtualPath = ConfigurationManager.AppSettings[“startPath“];
        protected string physicalPath =““;
        protected string virtualParentPath = ““;

        protected void Page_Load(object sender EventArgs e)
        {
            if (!IsPostBack)
            {
                bindData();
            }
        }
        /// 
        /// 文件上传
        /// 

        /// 
        /// 
        protected void btnUploadFile_Click(object sender EventArgs e)
        {
            if (!string.IsNullOrEmpty(file1.FileName))
            {
                initPath();
                string sp = physicalPath + file1.FileName;
                try
                {
                    file1.SaveAs(sp);
                    bindData();
                }
                catch
                {
                    litError2.Text = “上传失败“;
                }
            }
        }

        /// 
        /// 创建目录
        /// 

        /// 
        /// 
        protected void btnCreateDir_Click(object sender EventArgs e)
        {
            initPath();
            string dir = txtDirName.Text.Trim();
            
            if (dir.Length <= 0)
                return;
            dir = physicalPath + dir;
            try
            {
                Directory.CreateDirectory(dir);
                bindData();
            }
            catch (Exception ee)
            {
                litError.Text = “创建目录失败!“+ee.ToString();
            }
        }

        /// 
        /// 删除目录
        /// 

        /// 
        /// 
        protected void btnDelDir_Click(object sender EventArgs e)
        {
            string dirName = hfDir.Value.Trim();
            initPath();
            string delDir = physicalPath + dirName;
            try
            {
                recursiveDel(delDir);
                bindData();
            }
            catch
            {
                litError3.Text = “目录删除失败!“;
            }
        }

        /// 
        /// 删除文件
        /// 

        /// 
        /// 
        protected void btnDelFile_Click(object sender EventArgs e)
        {
            string FileName = hfDir.Value.Trim();
            initPath();
            string delFile = physicalPath + FileName;
            try
            {
                System.IO.File.Delete(delFile);
                bindData();
            }
  

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       1582  2009-03-26 13:47  WebFtp\WebFtp\App_Code\Pagebase.cs

     文件      11264  2009-03-27 09:42  WebFtp\WebFtp\bin\YUFEIS.WebFtp.dll

     文件      28160  2009-03-27 09:42  WebFtp\WebFtp\bin\YUFEIS.WebFtp.pdb

     文件       5031  2009-03-27 01:15  WebFtp\WebFtp\Default.aspx

     文件       8063  2009-03-27 01:16  WebFtp\WebFtp\Default.aspx.cs

     文件       6735  2009-03-26 09:30  WebFtp\WebFtp\Default.aspx.designer.cs

     文件       1402  2009-03-26 11:35  WebFtp\WebFtp\EditFile.aspx

     文件       2495  2009-03-27 01:16  WebFtp\WebFtp\EditFile.aspx.cs

     文件       2141  2009-03-26 10:39  WebFtp\WebFtp\EditFile.aspx.designer.cs

     文件       3980  2009-03-27 09:39  WebFtp\WebFtp\JS\Default_aspx.js

     文件        109  2009-03-26 10:00  WebFtp\WebFtp\JS\EditFile_aspx.js

     文件     130347  2008-10-21 05:48  WebFtp\WebFtp\JS\prototype.js

    ..A.SHR        97  2009-03-26 02:38  WebFtp\WebFtp\JS\vssver2.scc

     文件        251  2009-03-27 09:42  WebFtp\WebFtp\obj\Debug\WebFtp.csproj.FileListAbsolute.txt

     文件      11264  2009-03-27 09:42  WebFtp\WebFtp\obj\Debug\YUFEIS.WebFtp.dll

     文件      28160  2009-03-27 09:42  WebFtp\WebFtp\obj\Debug\YUFEIS.WebFtp.pdb

     文件       1393  2009-03-26 03:46  WebFtp\WebFtp\Properties\AssemblyInfo.cs

     文件       1241  2009-03-26 08:46  WebFtp\WebFtp\style\Default_aspx.css

     文件        697  2009-03-26 11:51  WebFtp\WebFtp\style\EditFile_aspx.css

    ..A.SHR       101  2009-03-26 02:20  WebFtp\WebFtp\style\vssver2.scc

     文件        779  2009-03-27 08:59  WebFtp\WebFtp\Test\Test.aspx

     文件       1528  2009-03-27 08:56  WebFtp\WebFtp\Test\Test.aspx.cs

     文件       1781  2009-03-27 08:32  WebFtp\WebFtp\Test\Test.aspx.designer.cs

     文件        441  2009-03-27 01:15  WebFtp\WebFtp\Web.config

     文件       4566  2009-03-27 08:34  WebFtp\WebFtp\WebFtp.csproj

     文件       1308  2009-03-27 08:34  WebFtp\WebFtp\WebFtp.csproj.user

     文件        929  2009-03-27 09:40  WebFtp\WebFtp\WebFtp.Publish.xml

     文件        908  2009-03-26 03:46  WebFtp\WebFtp.sln

    ..A..H.     22528  2009-03-27 10:35  WebFtp\WebFtp.suo

     目录          0  2009-03-27 01:13  WebFtp\WebFtp\obj\Debug\TempPE

............此处省略14个文件信息

评论

共有 条评论