<%using (Html.BeginForm("Upload", "Photos", new { id = Model.Gallery.GalleryID }, FormMethod.Post, new { @enctype = "multipart/form-data" }))
{%>
<p>
<span class="bold block">Photo 1:</span>
<input type="file" name="File1" class="block" />
<span class="bold block">File Name:</span>
<input type="text" class="txt-base width50" id="txtFile1" />
<span class="bold block">Description</span>
<input type="text" class="txt-base width80" id="txtCaption1" />
</p>
<p>
<input type="submit" class="btn-admin cursorPointer" value="Upload" />
</p>
<%}%>
我需要获得txtFile(i)和txtCaption(i)的数值。
for (int i = 0; i < Request.Files.Count ; i++)
{
var hpf = Request.Files[i];
var strFileName = Request.Form["txtFile" + (i + 1)];
var strCaption = Request.Form["txtCaption" + (i + 1)];
...
...
但是,由于是“FormMethod.Post”的方法,因此无法要求获得价值。 表格[“txtFile1”];
在计算方法时如何获得形式价值?
预 收