⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 default.aspx.cs

📁 全用Javascript编写的在线编辑器.
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Net;
using System.IO;
using System.Text;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            string file = Request.QueryString["file"].ToString().Trim();
           // byte[] buf = new byte[1024];

            
           // Encoding en = Encoding.GetEncoding("GB2312");
           // buf = en.GetBytes(file);
           //file=en.GetString(buf);
           
            if (file != "")
            {
                string uriString = "http://172.25.33.39/Me/MyEdit/FileLoad/UploadFile/a.jpg";

              //  uriString = HttpContext.Current.Server.MapPath(uriString);
                string fileNamePath = @file;
                
              //uriString = uriString + "a.jpg";
              Response.Write(uriString );
                ///       创建WebClient实例       
      		  WebClient myWebClient = new WebClient();

              FileStream fs = new FileStream(fileNamePath, FileMode.Open, FileAccess.Read);
             Response.Write(fs.Length.ToString());
       		 BinaryReader br = new BinaryReader(fs);

       		 Byte[] postArray = br.ReadBytes((int)(fs.Length));

        	Stream postStream = myWebClient.OpenWrite(uriString, "PUT");

        	if (postStream.CanWrite)
        	{
            	postStream.Write(postArray, 0, postArray.Length);
       		 }
                postStream.Close();
                fs.Close();
               
            }
        }
        catch (Exception a)
        {
         //   Response.Write(a.ToString());
        }
       
       
        
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -