0
我在我的頁面上有一些更新面板做一些asyncpostbacks,以保持一些dropdownlist正確填充。我的問題是,在我的網頁上我有一個處理一些文件上傳的HTML輸入。在帶有asyncpostbacks的頁面上使用AJAX,並且當我遍歷我的代碼時,這些文件不會被上傳。由於我的佈局,使用postbacktrigger(非異步)是不可能的。HTML輸入無法正常使用AJAX更新面板使用其他地方
這裏是我的代碼:
<div id="divFileInputs" runat="server">
<input id="file1" name="fileInput" type="file" runat="server" size="50" style="width: 50em"
onfocus="AddFileInput()" class="textbox" /></div>
<select id="selectFileList" name="ListBox1" size="5" style="width: 50em; text-align: left;"
class="textbox" />
<input id="RemoveAttachmentButton" type="button" value="Remove" onclick="RemoveFileInput()"
class="removebutton " />
</div>
這裏是我的代碼背後:
Protected Sub CopyAttachments(ByVal issueId As String)
Dim files As HttpFileCollection = Request.Files
Dim myStream As System.IO.Stream
Dim service As New SubmitService.Service
For i As Integer = 0 To files.Count - 1
Dim postedFile As HttpPostedFile = files(i)
Dim fileNameWithoutPath As String = System.IO.Path.GetFileName(postedFile.FileName)
If fileNameWithoutPath.Length > 0 And issueId.Length > 0 Then
Dim fileLength As Integer = postedFile.ContentLength
Dim fileContents(fileLength) As Byte
' Read the file into the byte array. Send it to the web service.
myStream = postedFile.InputStream
myStream.Read(fileContents, 0, fileLength)
service.ClearQuestAttachToIssue(issueId, fileNameWithoutPath, fileContents)
End If
Next
service = Nothing
End Sub
當我把一個斷點在服務的聲明,然後檢查的「文件」的價值,計數是0.我期待它是2當我有一個文件上傳。
任何人都知道如何解決這個問題?