input?type="file"?name="file"?multiple?/
為西鄉(xiāng)等地區(qū)用戶提供了全套網(wǎng)頁設(shè)計制作服務(wù),及西鄉(xiāng)網(wǎng)站建設(shè)行業(yè)解決方案。主營業(yè)務(wù)為網(wǎng)站設(shè)計制作、網(wǎng)站設(shè)計、西鄉(xiāng)網(wǎng)站設(shè)計,以傳統(tǒng)方式定制建設(shè)網(wǎng)站,并提供域名空間備案等一條龍服務(wù),秉承以專業(yè)、用心的態(tài)度為用戶提供真誠的服務(wù)。我們深信只要達(dá)到每一位用戶的要求,就會得到認(rèn)可,從而選擇與我們長期合作。這樣,我們也可以走得更遠(yuǎn)!
加個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
希望能幫到您。