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);
                                }
                            }

  • 相关阅读:
    Linux strip
    有趣的BUG
    GDB watch std::string size
    Redis Cluster Lua
    Double Buffer
    Yarn架构
    天池公交客流预测比赛
    hashmap,ConcurrentHashMap与hashtable的区别
    fail-fast和fail-safe
    常见机器学习算法优缺点
  • 原文地址:https://www.cnblogs.com/aaa6818162/p/1968197.html
Copyright © 2011-2022 走看看