1

次のページを実装する必要があります。

ユーザーは [ファイルのアップロード] ボタンをクリックし、ファイルを選択してサーバーにアップロードします。ファイルをアップロードした後、コンバーターによって処理されます。コンバーターは、コンバージョンのパーセンテージを返すことができます。ページに継続的な進行状況バーを実装する方法 (進行状況 = アップロードの進行状況 + 変換の進行状況)?

PlUpload を使用しています。このツールは、サーバーにファイルをアップロードする割合を返すことができますが、返される割合を上書きすることはできません。

私のアップロードアクション:

   public ActionResult ConferenceAttachment(int? chunk, string name, Identity cid)
    {
        var fileUpload = Request.Files[0];

        var tempfolder = Path.GetTempFileName().Replace('.', '-');
        Directory.CreateDirectory(tempfolder);
        var fn = Path.Combine(tempfolder, name);

        chunk = chunk ?? 0;
        using (var fs = new FileStream(fn, chunk == 0 ? FileMode.Create : FileMode.Append))
        {
            var buffer = new byte[fileUpload.InputStream.Length];
            fileUpload.InputStream.Read(buffer, 0, buffer.Length);
            fs.Write(buffer, 0, buffer.Length);
        }

        // CONVERTING ....

        return Content("OK", "text/plain");
    }

問題を解決できるアーキテクチャ ソリューションはどれですか? または、どの JS アップロード ライブラリですか?

4

2 に答える 2

4

You must use some kind of Real-Time connection or a Streaming to do this.

1) Using SignalR you can create a Hub to notificate the client about the progress, easy to implement and powerfull.

Learn About ASP.NET SignalR

2) You can adapte this example about PushStreamContent to send the progress while you are converting:

Asynchronously streaming video with ASP.NET Web API

于 2013-10-23T12:42:24.450 に答える