上传PDF文件并阅读慢速Internet连接问题

时间:2014-11-05 08:26:47

标签: c# asp.net file-upload

我正在开发一个应用程序,我需要上传PDF文件并读取该文件。我正在使用ITextSharp来读取文件。如果最终用户使用高Internet速度连接,该应用程序工作正常。但是在网速较慢的情况下,上传文件需要花费时间并且会引发错误。文件大小约为2 MB,这不是很大,但我仍然面临这个问题。 以下是用于上传pdf和阅读的代码。

if (flUpld.PostedFile.ContentLength > 0)
        {
            string ext = System.IO.Path.GetExtension(flUpld.PostedFile.FileName);
            if (ext == ".pdf")
            {
                string filename = "Test" + "_" + DateTime.Now.ToString("MMddyyhhmmss", CultureInfo.InvariantCulture) + ".pdf";
                filePath = Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["PDFLocation"]) + filename;
                // saving PDF
                flUpld.PostedFile.SaveAs(filePath);

                //reading PDF 
                data = val.fetchValue(filePath);
            }
        }

0 个答案:

没有答案