如何在不使用Flash的情况下监控文件上传?

时间:2021-01-07 02:03:39

I've been looking for a way to monitor file uploading information without using flash, but probably using ajax, i suppose. I want to monitor speed and percentage of finished file upload.

我一直在寻找一种方法来监控文件上传信息而不使用flash,但我想可能是使用ajax。我想监控速度和完成文件上传的百分比。

Do you know of any resource that describes how to do that, or what i should follow to do it ?

你知道有什么资源可以描述如何去做,或者我应该遵循什么去做吗?

2 个解决方案

#1


1  

In the pre-HTML5 world I believe this requires web-server support. I've used this Apache module successfully in the past:

在html5之前,我认为这需要web服务器的支持。我在过去成功地使用了这个Apache模块:

http://piotrsarnacki.com/2008/06/18/upload-progress-bar-with-mod_passenger-and-apache/

http://piotrsarnacki.com/2008/06/18/upload-progress-bar-with-mod_passenger-and-apache/

#2


0  

The only way without flash is to do it on the server. The gist is:

没有flash的唯一方法是在服务器上执行。要点是:

  • Start the file upload
  • 启动文件上传
  • Open a streaming connection to the server
  • 打开到服务器的流连接
  • Have the server read the post headers to tell you how large the file is going to be
  • 服务器是否读取了post头信息来告诉您文件的大小
  • Have the server repeatedly check the file size (in /tmp generally) to see how complete it is
  • 让服务器反复检查文件大小(通常在/tmp中),看看它有多完整
  • stream the % done back to the client
  • 将所做的%流回客户端

I've done it before in other languages, but never in ruby, so not sure of a project that's done it, sorry.

我以前用其他语言做过,但从来没有用过ruby,所以我不确定哪个项目做过,对不起。

#1


1  

In the pre-HTML5 world I believe this requires web-server support. I've used this Apache module successfully in the past:

在html5之前,我认为这需要web服务器的支持。我在过去成功地使用了这个Apache模块:

http://piotrsarnacki.com/2008/06/18/upload-progress-bar-with-mod_passenger-and-apache/

http://piotrsarnacki.com/2008/06/18/upload-progress-bar-with-mod_passenger-and-apache/

#2


0  

The only way without flash is to do it on the server. The gist is:

没有flash的唯一方法是在服务器上执行。要点是:

  • Start the file upload
  • 启动文件上传
  • Open a streaming connection to the server
  • 打开到服务器的流连接
  • Have the server read the post headers to tell you how large the file is going to be
  • 服务器是否读取了post头信息来告诉您文件的大小
  • Have the server repeatedly check the file size (in /tmp generally) to see how complete it is
  • 让服务器反复检查文件大小(通常在/tmp中),看看它有多完整
  • stream the % done back to the client
  • 将所做的%流回客户端

I've done it before in other languages, but never in ruby, so not sure of a project that's done it, sorry.

我以前用其他语言做过,但从来没有用过ruby,所以我不确定哪个项目做过,对不起。