WebClient myWebClient = new WebClient();
FolderBrowserDialog fbDialog = new FolderBrowserDialog();
if (fbDialog.ShowDialog() == DialogResult.OK)
{
string directoryPath = fbDialog.SelectedPath;
string[] fn = Directory.GetFiles(directoryPath);//E:\李四\区划所\样方数据\玉米\ym2011yj\photo\ym370082011
foreach (string s in fn)//E:\李四\区划所\样方数据\玉米\ym2011yj\photo\ym370082011\ym370082011EEF.JPG
{
myWebClient.UploadFile("http://localhost/WebSite/Default.aspx", "POST", s);
}
}
ym370082011下有几张图片,遍历传递至服务器中,想要把ym370082011文件夹也穿过去这个如何做啊
FolderBrowserDialog fbDialog = new FolderBrowserDialog();
if (fbDialog.ShowDialog() == DialogResult.OK)
{
string directoryPath = fbDialog.SelectedPath;
string[] fn = Directory.GetFiles(directoryPath);//E:\李四\区划所\样方数据\玉米\ym2011yj\photo\ym370082011
foreach (string s in fn)//E:\李四\区划所\样方数据\玉米\ym2011yj\photo\ym370082011\ym370082011EEF.JPG
{
myWebClient.UploadFile("http://localhost/WebSite/Default.aspx", "POST", s);
}
}
ym370082011下有几张图片,遍历传递至服务器中,想要把ym370082011文件夹也穿过去这个如何做啊
protected void Page_Load(object sender, EventArgs e)
{
for (int i = 0; i < Request.Files.Count; i++)
{
string extension = System.IO.Path.GetExtension(Request.Files[i].FileName);
Guid g_ = Guid.NewGuid();
string fileName = g_.ToString() + extension;
string fileP=Server.MapPath("~/files/");
string filePath = Server.MapPath("~/files/") + fileName;
Request.Files[i].SaveAs(filePath);
if (extension == ".zip")
{
string err;
UnZipFile(filePath, fileP, out err);
}
Response.Write(fileName);
Response.End();
}
}不知道出错在哪,各位帮忙看看
搜索asp.net 上传限制