0

私のアプリでは、ユーザーは自分のファイル (画像、pdf、単語など) をダウンロードできます。HttpHandel を使用して実行します。ファイルの選択とダウンロードを開始します。ユーザーがリストからすべてのファイルをダウンロードできるようにしたいのですが、どうすればよいですか ここに画像の説明を入力

 public void ProcessRequest(HttpContext context) {

        HttpResponse response = context.Response;
        string cururl = context.Request.Url.ToString();
        int iqs = context.Request.Url.ToString().IndexOf('?');
        string querystring = (iqs < cururl.Length - 1) ? cururl.Substring(iqs + 1) : String.Empty;
        NameValueCollection parameters = HttpUtility.ParseQueryString(querystring);
        byte[] result = GetstreamForDownload(parameters);
        string fileId = context.Request.QueryString["fileId"];
        response.AddHeader("Content-disposition", "attachment; filename=" + GetFileName(parameters));
        response.ContentType = "application/octet-stream";
        response.BinaryWrite(result);

}
4

1 に答える 1

0

メソッドは、選択した特定のキーと値のペアが含まれているGetstreamForDownload()場合、Zip アーカイブなどのすべてのファイルを返す必要があります。parameters?folderId=123&allFiles=true

于 2013-06-08T12:29:17.103 に答える