Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

Multiple File Upload Problem

$
0
0

I'm using a asp.net file uploader control, but whem the user select the file twice, the first selecion is reseted. For example: I select 3 files, before click the Upload button, I click on "Browse" again again, and select two more. Than I click on the Upload button. If I call Resquest.Files, i will get only the last two files. I need to get all the 5 files.

Conclusion: What I need to achieve is: select files multiple times using the upload file control , and keep all the selections.

WebForm1.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="FotoFacil.WebForm1" %><!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"><title></title></head><body><form id="form1" runat="server"><div><asp:FileUpload ID="files" name="files[]" accept='image/*' runat="server" AllowMultiple="true" /><asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Upload" /></div></form></body></html>

WebForm1.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace FotoFacil
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            Response.Redirect(Request.Files.Count.ToString()); // This, in my example, return: 2
        }
    }
}

Actually, the code I posted, Is just an example.. My real code is: StepOne.aspx and StepOne.aspx.cs


Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>