私はASP.net
ウェブアプリケーションを持っており、セッションに入力されたすべての詳細を保存し、最後にアップロードされたファイルの添付ファイルを含むすべての詳細を含むメールを送信します。Asp.net複数のファイルアップロード
問題は、ファイルのアップロードページに変更が必要だということです。複数のドキュメントをアップロードできるようになりましたが、個別にアップロードするファイルを見つけて[追加]ボタンをクリックすると、基本的にユーザーはファイルをアップロードできます。アップロードファイルフィールドはクリアされ、アップロードされた各ファイルの '削除/削除'ボタンを使用して、アップロードされたファイルがテーブルに表示されます。このテーブルに表示されなければならない
の詳細は以下のとおりです。
- ファイル名
- オプション選択したフォーム私は、単一の持って言ったように、新しいドロップダウンリスト
- 削除]ボタン
コードの背後にあるコードを使用してファイルをアップロードしていますが、アップロードしたすべてのドキュメントが自分のメールで送信されるように、どのように実装するのか分かりません。
現在のHTML
<div class="form-group">
<div class="col-sm-offset-2 col-sm-5">
<div class="fileinput fileinput-new input-group" data-provides="fileinput">
<div class="form-control" data-trigger="fileinput" style="background-color: #ededed">
<span class="fileinput-filename"></span>
</div>
<span class="input-group-addon btn btn-default btn-file">
<span class="fileinput-new">
<span class="glyphicon glyphicon-folder-open" title="Click to select a file."></span>
</span>
<span class="fileinput-exists">
<span class="glyphicon glyphicon-folder-open" title="Click to change the selected file."></span>
</span>
<input type="file" name="..." id="fuAttachment" runat="server" />
</span>
</div>
</div>
<div class="col-sm-3">
<asp:DropDownList ID="Step03WebTypeDD" runat="server" class="form-control">
<asp:ListItem Value="- - Please select - -">- - Please select - -</asp:ListItem>
<asp:ListItem Value="Requirements">Requirements</asp:ListItem>
<asp:ListItem Value="Functional specification">Functional specification</asp:ListItem>
<asp:ListItem Value="Page Content">Page Content</asp:ListItem>
<asp:ListItem Value="Page Designs">Page Designs</asp:ListItem>
<asp:ListItem Value="Page Designs">Other</asp:ListItem>
</asp:DropDownList>
</div>
<div class="col-sm-1">
<asp:LinkButton ID="UploadAddButton" runat="server" OnClick="Step05UploadAddButton_Click" CssClass="btn btn-success pull-right" ToolTip="Click to upload the file.">
<span class="glyphicon glyphicon-plus"></span> Add
</asp:LinkButton>
</div>
</div>
現在のコードの後ろ
protected void Step05UploadAddButton_Click(object sender, EventArgs e)
{
var file = fuAttachment.PostedFile;
if (file != null && fuAttachment.PostedFile.FileName != "")
{
var content = new byte[file.ContentLength];
file.InputStream.Read(content, 0, content.Length);
Session["FileContent"] = content;
Session["FileContentType"] = file.ContentType;
Session["File"] = fuAttachment.PostedFile.FileName;
Session["AttachmentProvided"] = "Yes";
}
else
{
Session["FileContent"] = "";
Session["FileContentType"] = "";
Session["File"] = "";
Session["AttachmentProvided"] = "No";
}
}
私のコードの後ろに選択されたオプションを取得しませんが、私は私の確認ページに表示することができますする必要があります(以下に示すHTML)
<div class="form-group">
<asp:Label ID="Label6" class="col-xs-6 col-sm-3 control-label" runat="server" Text="Attachment provided:"></asp:Label>
<div class="col-xs-6 col-sm-9 form-control-static">
<% if (Session["AttachmentProvided"] == "Yes")
{%>
Yes (<%=Session["File"] %>)
<%}
else
{ %>
No
<%} %>
</div>
</div>