在 .NET 中上传大文件 [英] Upload large files in .NET

查看:24
本文介绍了在 .NET 中上传大文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经做了大量研究,以找到一个适用于 .NET 的上传组件,我可以用它来上传大文件、有一个进度条,并且可以恢复大文件的上传.我遇到过一些组件,例如 AjaxUploaderSlickUploadPowUpload,仅举几例.这些选项中的每一个都需要花钱,只有 PowUpload 执行可恢复的上传,但它使用 java 小程序来完成.我愿意为一个能够很好地完成这些事情的组件付费,但如果我能自己编写它就最好了.

I've done a good bit of research to find an upload component for .NET that I can use to upload large files, has a progress bar, and can resume the upload of large files. I've come across some components like AjaxUploader, SlickUpload, and PowUpload, to name a few. Each of these options cost money and only PowUpload does the resumable upload, but it does it with a java applet. I'm willing to pay for a component that does those things well, but if I could write it myself that would be best.

我有两个问题:

  1. 是否可以在不使用 flash/java/Silverlight 的情况下在客户端恢复文件上传?
  2. 有没有人有一些代码或文章的链接来解释如何编写允许流式上传和 ajax 进度条的 .NET HTTPHandler?

谢谢,
奥斯汀

我意识到我确实需要能够为我的项目进行可恢复的文件上传,对于可以做到这一点的组件有什么建议吗?

I realized I do need to be able to do resumable file uploads for my project, any suggestions for components that can do that?

推荐答案

1) 是否可以在不使用 flash/java/Silverlight 的情况下在客户端恢复文件上传?

1) Is it possible to resume a file upload on the client without using flash/java/Silverlight?

没有.实际的 HTTP 协议本身不支持部分上传的恢复,因此即使您确实使用了 flash 或 silverlight,您仍然需要在服务器上使用其他东西,例如 FTP.
过去,我通过用 C# 编写自定义客户端应用程序解决"了这个问题,该应用程序将文件分解成小块(2meg),分别传输,然后服务器将它们全部组合在一起.

No. The actual HTTP protocol itself does not support resume of partial uploads, so even if you did use flash or silverlight, you'd still need to use something else like FTP on the server.
I've "solved" this problem in the past by writing a custom client application in C# which broke the file down into small chunks (2meg), transmitted those separately, and then the server combines them all back together.

2) 有没有人有一些代码或文章链接,解释如何编写允许流式上传和 ajax 进度条的 .NET HTTPHandler?

2) Does anyone have some code or a link to an article that explains how to write a .NET HTTPHandler that will allow streaming upload and an ajax progress bar?

虽然这不能解决简历"问题,但我在客户端使用了 SWFUpload 并且它工作出色.它提供了一个智能文件浏览器(您可以在其中提示用户仅输入 jpeg 文件等)和上传进度跟踪,完全不需要修改您的服务器.

While this doesn't solve the 'resume' problem, I've used SWFUpload on the client side and it worked brilliantly. It provides a smart file browser (where you can prompt the user for only jpeg files, etc) and upload progress tracking, all without needing to modify your server at all.

这篇关于在 .NET 中上传大文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆