首页 新闻 会员 周边

asp.net 既能选择文件又能选择文件夹

0
悬赏园豆:20 [已解决问题] 解决于 2017-02-09 14:47

大家好,我现在想实现点击一个按钮之后弹出一个选择文件的对话框,在对话框里既能选择文件又能选择文件夹,类似于qq发送文件/文件夹的功能,但是在网上查了一些资料,大部分都是分开的

//发送文件  
private void btnFile_Click(object sender, EventArgs e)          
 { 
        OpenFileDialog fileDialog = new OpenFileDialog(); 
        fileDialog.Multiselect = true;
        fileDialog.Title = "请选择文件";   
        fileDialog.Filter="所有文件(*.*)|*.*";
        if (fileDialog.ShowDialog() == DialogResult.OK) 
              {    
               string file=fileDialog.FileName;    
               MessageBox.Show("已选择文件:" + file,"选择文件提示",MessageBoxButtons.OK,MessageBoxIcon.Information);   
              }       
    }           
         //发送文件夹         
         private void btnPath_Click(object sender, EventArgs e) 
         {      
               FolderBrowserDialog dialog = new FolderBrowserDialog();     
               dialog.Description = "请选择文件路径";      
               if (dialog.ShowDialog() == DialogResult.OK)     
               {         
                     string foldPath = dialog.SelectedPath;    
                     MessageBox.Show("已选择文件夹:" + foldPath, "选择文件夹提示", MessageBoxButtons.OK, MessageBoxIcon.Information);      
               }  
         }  

有什么办法可以在同一个弹出窗口中实现,希望大家能给点儿思路,谢谢了!

雪~中~狼的主页 雪~中~狼 | 初学一级 | 园豆:188
提问于:2013-12-24 09:36
< >
分享
最佳答案
0

自己写一个弹框控件就可以了

收获园豆:8
笑云 | 菜鸟二级 |园豆:265 | 2013-12-24 10:48
其他回答(1)
0

浏览器的上传控件只能选文件的。

收获园豆:12
geass.. | 园豆:1821 (小虾三级) | 2013-12-24 10:56
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册