views:

83

answers:

1
<%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>
        <%}%>

I need to get values of txtFile(i) and 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)];
                ...
                ...

But because of being method is "FormMethod.Post" i cant get the values with Request.Form["txtFile1"];

How can i get the form values while it's method is post ?

Thanks in advance

+1  A: 

Put 'name' attributes in your form input elements (not only 'id's).

Maxwell Troy Milton King
Oops i forgot them, you are absolutely right. Feel like weird after webforms, thanks again
Barbaros Alp