zoukankan      html  css  js  c++  java
  • 通过流获取Internet上的文件

    HttpWebRequest httprequest = null;
            HttpWebResponse httpresponse = null;
            Stream sr = null;
            //try
            //{
                httprequest = (HttpWebRequest)WebRequest.Create("http://donor.km169.net/music/200410/5189.wma");
                httpresponse = (HttpWebResponse)httprequest.GetResponse();
                            httpresponse = (HttpWebResponse)httprequest.GetResponse();
                Stream stream = httpresponse.GetResponseStream();
                byte[] _byte = new byte[1024];
                int length,_length;
                FileStream fs = new FileStream(Server.MapPath("~/images/ty.wma"), FileMode.Create);
               _length=stream.Read(_byte, 0, 1024);
               while (_length > 0)
               {
                   fs.Write(_byte, 0, _length);
                   _length = stream.Read(_byte, 0, 1024);
               }
               fs.Flush();
               fs.Close();
               stream.Close();
               Response.Write("<script>alert(1);</script>");
  • 相关阅读:
    CF1450H2
    CF1379F2
    CF1217F
    CF1393E2
    CF1510H
    CF1514E
    CF1515G
    CF1516E
    在pycharm中导入PyMysql出错,解决方法
    搭建fastdfs文件服务器
  • 原文地址:https://www.cnblogs.com/xinzhuangzi/p/4100705.html
Copyright © 2011-2022 走看看