0

我试图确定当从 asp:wizard 调用“Next”时是否可以发送文件数组。

我以前用一个简单的方法进行过这个工作,但是我被迫更改它,因为您无法从 FileObject 中删除单个文件。相反,我现在将通过输入添加的任何文件添加到数组中以解决此问题。

但是,我现在处于不确定如何在提交时将这些文件添加到表单数据的位置。

编辑:

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

在此向导步骤中,我有一个自定义用户控件,其中包含 type="file" 的 HTML 输入,并且此屏幕要求用户将多个文件添加到页面,但能够删除单个文件。

<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>

为了解决这个问题,我目前有一个事件监听器,它在更改时将发送的文件复制到一个新的数组客户端数组。当他们单击下一步按钮时,我需要将此客户端文件列表添加到向导创建的顶级表单中。

// 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
4

0 回答 0