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

  • 相关阅读:
    静态包含与动态包含
    REST风格下如何放行静态资源
    java迭代器
    es6之扩展运算符 三个点(...)
    关于Echarts配置项的工作记录
    vscode中vue代码格式化的相关配置
    v-loading
    git中Please enter a commit message to explain why this merge is necessary.
    slot
    slot的使用方法
  • 原文地址:https://www.cnblogs.com/aaa6818162/p/1968197.html
Copyright © 2011-2022 走看看