資源簡(jiǎn)介
asp.net 實(shí)現(xiàn)的 Web 版Ftp,可上傳文件,文件刪除,文件重命名,文本文件的編輯,創(chuàng)建文件夾, 刪除文件夾等,通過(guò)web.config 可設(shè)置訪(fǎng)問(wèn)權(quán)限

代碼片段和文件信息
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?=?“上傳失敗“;
????????????????}
????????????}
????????}
????????///?
????????///?創(chuàng)建目錄
????????///?
????????///?
????????///?
????????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?=?“創(chuàng)建目錄失敗!“+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();
????????????}
??
?屬性????????????大小?????日期????時(shí)間???名稱(chēng)
-----------?---------??----------?-----??----
?????文件???????1582??2009-03-26?13:47??WebFtp\WebFtp\App_Code\Pageba
?????文件??????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\st
?????文件????????697??2009-03-26?11:51??WebFtp\WebFtp\st
????..A.SHR???????101??2009-03-26?02:20??WebFtp\WebFtp\st
?????文件????????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.xm
?????文件????????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個(gè)文件信息
評(píng)論
共有 條評(píng)論