开发者

Measure upload time?

I have a very simple page with which a user uploads a file. Using only server-side 开发者_Go百科C# (e.g. the code-behind), how can I measure the amount of time the user had to wait for the file to upload?


This is very difficult (well, it was in IIS6). You need to write an HttpModule to intercept the upload and handle it, then using the total size of the file coming in (it's in the header of the request), calculate how many bytes per second you're getting, and then you can calculate how much time is left.

However, you cannot do any of this with just the code-behind file -- the file is already uploaded and available by the time the request gets to the asp.net handler.


I had to find something like this and I'm using this.


If you're not concerned with complete accuracy, you can send a quick call to the server to indicate that an upload is starting, followed immediately by the upload request. The server can then measure the time between the first call and the completion of the second call.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜