日期:2014-05-18  浏览次数:20727 次

导入文件夹中的所有图片
怎么把文件夹中的所有图片一下导入到数据库中???

------解决方案--------------------

OpenFileDialog opd = new OpenFileDialog();
if (opd.ShowDialog() == DialogResult.OK)
{
str = opd.FileName;
}
DirectoryInfo d = new DirectoryInfo(@str.Substring(0,str.IndexOf('\\')));
foreach(FileInfo myfile in d.GetFiles())
{
string s = myfile.Name;
MessageBox.Show(s.Substring(s.IndexOf('.')+1, 3));
if (s.Substring(s.IndexOf('.')+1, 3) == "jpg")

}
}