同桌上课用手指进去了好爽_欧美丰满熟妇xxⅹⅹ性大i_成人av天天日天天拍拍_猛男gay帅男gay男男同志_欧美va天堂在线观看_人妻无码av中文系列三里桃花_亚欧免费无码在线观看_久久久精品国产亚洲av水_日韩在线免费看污污污_2021无码专区人妻系列日韩

首頁(yè) 優(yōu)化推廣 一個(gè)簡(jiǎn)單的asp.net 管理Web站點(diǎn)文件的頁(yè)面程序

一個(gè)簡(jiǎn)單的asp.net 管理Web站點(diǎn)文件的頁(yè)面程序

來(lái)源: | 時(shí)間:2013/10/30 16:26:31 |

先看效果

 

WebFileManager

 代碼如下
<!--
Author: 張浩華
DateTime: 2012-07-06 03:25
-----------------------------------
管理Web站點(diǎn)下文件的頁(yè)面程序。
提供上傳、重命名、刪除、創(chuàng)建文件夾、下載等功能。
-->
<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
    string Msg = string.Empty;
    static string _CURRENT_PATH = "";
   
    protected void Page_Load(object sender, EventArgs e)
    {
        InitFiles();
        switch (Request["action"])
        {
            case "Root":
                Root();
                break;
            case "Back":
                Back();
                break;
            case "Open":
                Open(Request["FileName"]);
                break;
            case "Delete":
                Delete(Request["FileName"]);
                break;
        }
    }

    protected void btnUpload_Click(object sender, EventArgs e)
    {
        if (fuFile.HasFile)
        {
            string currentPath = GetCurrentPath();
            string fileName = fuFile.FileName;
            if (rbCover.Checked)
            {
            }
            else if (rbRename.Checked)
            {
                while (System.IO.File.Exists(currentPath + fileName))
                {
                    fileName = "new_" + fileName;
                }
            }
            fuFile.SaveAs(currentPath + fileName);
        }
        InitFiles();
    }

    protected void btnSave_Click(object sender, EventArgs e)
    {
        string oleFileName = hfOldName.Value;
        string newFileName = txtNewName.Text;
        if (string.IsNullOrEmpty(newFileName))
        {
            Msg = "The file name can't for empty !";
            return;
        }
       
        string currentPath = GetCurrentPath();
        string oldPath = currentPath + oleFileName;
        string newPath = currentPath + newFileName;
        if (IsFile(oldPath))
        {
            if (System.IO.File.Exists(newPath))
            {
                Msg = "The file name repeated, please reset.";
                return;
            }
            System.IO.File.Move(oldPath, newPath);
        }
        else
        {
            if (string.IsNullOrEmpty(oleFileName))
            {
                System.IO.Directory.CreateDirectory(newPath);
            }
            else
            {
                System.IO.Directory.Move(oldPath, newPath);
            }
        }
        InitFiles();
    }

    private void Back()
    {
        string path = GetCurrentPath();
        string parent = new System.IO.DirectoryInfo(path).Parent.FullName + "\";
        if (parent.IndexOf(Server.MapPath("~/")) >= 0)
        {
            _CURRENT_PATH = parent;
        }
        Response.Redirect(Request.Url.AbsolutePath);       
    }
   
    private void Delete(s

服務(wù)熱線

153 8323 9821

功能和特性

價(jià)格和優(yōu)惠

網(wǎng)站和維護(hù)

推廣和優(yōu)化

微信服務(wù)號(hào)