日期:2014-05-17  浏览次数:20861 次

c#winform中如何实现下载后的多个文件到同一个文件夹下
附上我写的下载和找并创建文件的代码,但是运行之后显示无路径:
        private void picturedownload()
        {
            try
            {      
                WebRequest request = WebRequest.Create(URI); //创建了request对象,向服务器发送请求
                HttpWebResponse response = (HttpWebResponse)request.GetResponse();//将得到的响应传给响应对象response   
                Stream st = response.GetResponseStream();                
                int buffersize = 10000;
                byte[] bt = new byte[buffersize];   //创建文件缓冲
                FileStream write = new FileStream(filename, FileMode.OpenOrCreate);
                int intbuffer = st.Read(bt, 0, buffersize);
                while (intbuffer > 0)
                {
                    write.Write(bt, 0, intbuffer);
                    intbuffer = st.Read(bt, 0, buffersize);
                }
                st.Close();
                write.Close();
                response.Close();
                directory();
                bt=null;
            }
          catch (Exception ex )
            {
               MessageBox.Show("没有下载成功!"+ex.ToString());
            }
        }
        private void button3_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog folder;
            folder = new Fo