zoukankan      html  css  js  c++  java
  • 上传文件带进度条

       // 保存字节
                            using (FileStream fs = new FileStream(Path.Combine(path, fileName), FileMode.Create))
                            {                        
                                while (uploadInfo.UploadedLength < uploadInfo.ContentLength)
                                {
                                   //从输入流放进缓冲区
                                    int bytes = this.fileUpload.PostedFile.InputStream.Read(buffer, 0, bufferSize);
                                    // 字节写入文件流
                                    fs.Write(buffer, 0, bytes);
                                    //  更新大小
                                    uploadInfo.UploadedLength += bytes;

                                    //  线程睡眠 上传就更慢 这样就可以看到进度条了
                                    System.Threading.Thread.Sleep(100);
                                }
                            }

  • 相关阅读:
    php header
    How to Share a Theme With All Users in a Windows 7 Computer?
    240多个jQuery插件
    Delphi读写UTF8、Unicode格式文本文件
    虚拟网关解决ARP批处理版
    从煎蛋网上抓取妹子图
    在【批处理】中过滤特殊字符
    反序列化(临时)
    python发邮件实例
    反序列化(临时)
  • 原文地址:https://www.cnblogs.com/aaa6818162/p/1968197.html
Copyright © 2011-2022 走看看