File uploads through web pages using the standard HTML input always seems clunky to me. If the user tries to upload a large file, it can go on forever and they get no queue that the file is actually being uploaded.
使用标准HTML输入通过网页上传文件对我来说似乎总是很笨拙。如果用户尝试上传大文件,它可以永远继续,并且它们不会获得文件实际上传的队列。
I have tried to do things like provide a gif graphic that is an animated graphic bar, but it doesn't give the user any indication of how much is uploaded. I have even tried to do a progress bar with AJAX, but those were always ugly and never seemed to work right.
我试图做一些事情,比如提供一个动画图形栏的gif图形,但它不会向用户提供任何上传量的指示。我甚至试图用AJAX做一个进度条,但那些总是丑陋的,似乎永远不会正常工作。
This has been an issue with many of my clients, and often I'm asked if there is a better way. Sometimes I'll just provide them an FTP site so they can upload it there, but that's not a practical solution either.
这对我的许多客户来说都是一个问题,我经常被问到是否有更好的方法。有时我会给他们提供一个FTP站点,以便他们可以上传到那里,但这也不是一个实用的解决方案。
What do you think the best way to handle HTTP file uploads from HTML is? What are some good ideas / examples you have seen around the internet?
您认为从HTML处理HTTP文件上传的最佳方法是什么?您在互联网上看到了哪些好的想法/例子?
8 个解决方案
#1
1
There are several techniques for asynchronous file transfer with a progress bar over HTTP, most of which involve either Flash or XMLHttpRequest.
有几种通过HTTP使用进度条进行异步文件传输的技术,其中大多数涉及Flash或XMLHttpRequest。
#2
1
There are a number of client side controls that one can use.
可以使用许多客户端控件。
You can
- Build your own ActiveX control. Windows/IE only
- Use Flash to queue up files and upload them one at a time to the server using the stanard file upload protocol.
- Use a signed java applet to upload.
- Write a browser plugin.
构建自己的ActiveX控件。仅适用于Windows / IE
使用Flash将文件排队,并使用stanard文件上载协议将文件一次上传到服务器。
使用已签名的Java小程序进行上传。
编写一个浏览器插件。
Some random links from google:
谷歌的一些随机链接:
http://www.element-it.com/MultiPowUpload.aspx
#3
1
I'll add swfupload to this. It's an open source flash uploader that can degrade gracefully if the user doesn't have flash.
我将swfupload添加到此。它是一个开源闪存上传器,如果用户没有闪存,可以优雅地降级。
#4
1
There's really only the one mechanism for uploading via a browser. You can, however, dress it up and make it more user friendly by providing a progress bar to show that the upload is progressing and at what speed.
实际上只有一种机制可以通过浏览器上传。但是,您可以通过提供进度条来显示上传正在进行以及以何种速度打扮,并使其更加用户友好。
This is typically done by targeting the upload form at a hidden iframe and using AJAX calls to find out how much of the file has reached the server.
这通常是通过在隐藏的iframe上定位上传表单并使用AJAX调用来查找文件已到达服务器的数量来完成的。
Here's one example of this:
这是一个例子:
#5
0
If you running a mod_perl2 apache there is the Apache2::UploadProgress module. This adds an id to the http upload request, you then query the server for the progress of that upload. Has built in support for creating an AJAX progress bar in a popup window or within the page doing the upload. If you want to build your own progress display you can get the info back as XML or JSON data.
如果你运行mod_perl2 apache,那就是Apache2 :: UploadProgress模块。这会在http上传请求中添加一个id,然后查询服务器以获取该上载的进度。内置支持在弹出窗口或执行上载的页面内创建AJAX进度条。如果要构建自己的进度显示,可以将信息作为XML或JSON数据返回。
#6
0
The YUI Uploader utility uses a Flash-based uploader, is well documented, and has several examples for you to try. I've used it on several projects, and would recommend it.
YUI Uploader实用程序使用基于Flash的上传器,文档齐全,并有几个示例供您尝试。我已经在几个项目中使用它,并会推荐它。
#7
0
I use this one for a fairly simple and complete tool. The base sourcecode is good and you can easily customize it if necessary. AJAX File Upload
我用这个是一个相当简单和完整的工具。基本源代码很好,您可以根据需要轻松自定义它。 AJAX文件上传
#8
0
Interesting, no one has mentioned NeatUpload upload component by Dean Brettle, it has lots of interesting features and runs on MONO, too
有趣的是,没有人提到Dean Brettle的NeatUpload上传组件,它有很多有趣的功能,也可以在MONO上运行
#1
1
There are several techniques for asynchronous file transfer with a progress bar over HTTP, most of which involve either Flash or XMLHttpRequest.
有几种通过HTTP使用进度条进行异步文件传输的技术,其中大多数涉及Flash或XMLHttpRequest。
#2
1
There are a number of client side controls that one can use.
可以使用许多客户端控件。
You can
- Build your own ActiveX control. Windows/IE only
- Use Flash to queue up files and upload them one at a time to the server using the stanard file upload protocol.
- Use a signed java applet to upload.
- Write a browser plugin.
构建自己的ActiveX控件。仅适用于Windows / IE
使用Flash将文件排队,并使用stanard文件上载协议将文件一次上传到服务器。
使用已签名的Java小程序进行上传。
编写一个浏览器插件。
Some random links from google:
谷歌的一些随机链接:
http://www.element-it.com/MultiPowUpload.aspx
#3
1
I'll add swfupload to this. It's an open source flash uploader that can degrade gracefully if the user doesn't have flash.
我将swfupload添加到此。它是一个开源闪存上传器,如果用户没有闪存,可以优雅地降级。
#4
1
There's really only the one mechanism for uploading via a browser. You can, however, dress it up and make it more user friendly by providing a progress bar to show that the upload is progressing and at what speed.
实际上只有一种机制可以通过浏览器上传。但是,您可以通过提供进度条来显示上传正在进行以及以何种速度打扮,并使其更加用户友好。
This is typically done by targeting the upload form at a hidden iframe and using AJAX calls to find out how much of the file has reached the server.
这通常是通过在隐藏的iframe上定位上传表单并使用AJAX调用来查找文件已到达服务器的数量来完成的。
Here's one example of this:
这是一个例子:
#5
0
If you running a mod_perl2 apache there is the Apache2::UploadProgress module. This adds an id to the http upload request, you then query the server for the progress of that upload. Has built in support for creating an AJAX progress bar in a popup window or within the page doing the upload. If you want to build your own progress display you can get the info back as XML or JSON data.
如果你运行mod_perl2 apache,那就是Apache2 :: UploadProgress模块。这会在http上传请求中添加一个id,然后查询服务器以获取该上载的进度。内置支持在弹出窗口或执行上载的页面内创建AJAX进度条。如果要构建自己的进度显示,可以将信息作为XML或JSON数据返回。
#6
0
The YUI Uploader utility uses a Flash-based uploader, is well documented, and has several examples for you to try. I've used it on several projects, and would recommend it.
YUI Uploader实用程序使用基于Flash的上传器,文档齐全,并有几个示例供您尝试。我已经在几个项目中使用它,并会推荐它。
#7
0
I use this one for a fairly simple and complete tool. The base sourcecode is good and you can easily customize it if necessary. AJAX File Upload
我用这个是一个相当简单和完整的工具。基本源代码很好,您可以根据需要轻松自定义它。 AJAX文件上传
#8
0
Interesting, no one has mentioned NeatUpload upload component by Dean Brettle, it has lots of interesting features and runs on MONO, too
有趣的是,没有人提到Dean Brettle的NeatUpload上传组件,它有很多有趣的功能,也可以在MONO上运行