input type="file" name="file" multiple /
为西乡等地区用户提供了全套网页设计制作服务,及西乡网站建设行业解决方案。主营业务为网站设计制作、网站设计、西乡网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!
加个multiple 然后进行上传操作
按照此方法绝对OK
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim opfile As New OpenFileDialog '声名新open 窗口
Dim filetmp() As String '存文件名
opfile.Filter = "文本文件(*.txt)|*.txt|所有文件(*.*)|*.*" '添加过滤文件
opfile.Multiselect = True '多开文件打开
If opfile.ShowDialog = Windows.Forms.DialogResult.OK Then '如果打开窗口OK
If opfile.FileName "" Then '如果有选中文件
ReDim filetmp(opfile.SafeFileNames.Length)
filetmp = opfile.SafeFileNames '取文件名
For i As Integer = 0 To filetmp.Length - 1
ListBox1.Items.Add(filetmp(i)) '添加文件名
Next
End If
End If
End Sub
您可以选择使用CheckListBox控件。CheckListBox支持多选。
由于不清楚您用什么语言,所以我写了VB.net 、C#.net
vb.net Code
' Determine if there are any items checked.
If CheckedListBox1.CheckedItems.Count 0 Then
' If so, loop through all checked items and print results.
Dim x As Integer
Dim s As String = ""
For x = 0 To CheckedListBox1.CheckedItems.Count - 1
s = s "Checked Item " (x + 1).ToString " = " CheckedListBox1.CheckedItems(x).ToString ControlChars.CrLf
Next x
MessageBox.Show(s)
End If
C#.net Code
// Determine if there are any items checked.
if(checkedListBox1.CheckedItems.Count != 0)
{
// If so, loop through all checked items and print results.
string s = "";
for(int x = 0; x = checkedListBox1.CheckedItems.Count - 1 ; x++)
{
s = s + "Checked Item " + (x+1).ToString() + " = " + checkedListBox1.CheckedItems[x].ToString() + "\n";
}
MessageBox.Show (s);
}
vb.net Code
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim selectstr As String = ""
For i As Integer = 0 To Me.CheckedListBox1.Items.Count - 1
If Me.CheckedListBox1.GetItemChecked(i) Then
selectstr = Me.CheckedListBox1.Items(i).ToString
End If
Next
MsgBox(selectstr)
End Sub
希望能帮到您。