Add array of files client side to ASPX wizard next step

50 Views Asked by At

I am try to determine if it is possible to send an array of files when "Next" is called from an asp:wizard.

I had this working previously with a simple however I was forced to change it because you cannot remove individual files from the FileObject. Instead I am now adding any files added via the input to an array to get around this.

However I am now in a position where I am not sure how to add these files to the form data on submit.

EDIT:

<asp:Wizard ID="wizImport" runat="server" OnFinishButtonClick="wizImport_FinishButtonClick" OnPreviousButtonClick="wizImport_PreviousButtonClick" OnNextButtonClick="wizImport_NextButtonClick">
        <WizardSteps>
            <asp:WizardStep ID="wizImportStep1" runat="server">

Within this wizard step I have a custom user control that includes a HTML input of type="file" and this screen requires a user to be add multiple files to the page, but be able to remove individual files.

<input class="fileInput" type="file" id="imgInputFile" data-label="imgInputFileLabel" runat="server" style="display: none;"/>
<asp:Label runat="server" AssociatedControlID="imgInputFile" class="uploadButton" Text="Select"></asp:Label>

To get around this I currently have an event listener that on change, copies the file(s) sent to a new array client side array. I need to add this client side list of files to the top level form created by the wizard when they click the next button.

// Setup the listener on the specific file input control
var fileInput = $('#imgInputFile.ClientID');
fileInput.each(function () {
    this.addEventListener('change', handleInputFileSelect, false);
});
// In this function, I just grab the file and add it to a var called uploadedFiles which is an array
0

There are 0 best solutions below