如何保存客户端的fileupload传递过来的文件? 由于要一次上传多个文件,而且文件数量不定,所以<input type='file'/>是由客户端动态生成的,那么如何保存这些html的file到服务器上? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 以下即可。private void btnSend_Click(object sender, System.EventArgs e){ StringBuilder sb = new StringBuilder(); int attCount = 0; string filePath = ""; for(int i=0; i< Request.Files.Count; i++) { if(Request.Files[i].ContentLength > 0) { filePath = Request.Files[i].FileName; sb.Append("Files" + attCount++ + ": " + filePath + "<br>"); int n = filePath.LastIndexOf("\\"); Request.Files[0].SaveAs(Server.MapPath("./") + filePath.Substring(n+1)); } } sb.Insert(0, "you upload " + attCount + " files.<br>"); Response.Write(sb.ToString());} repeater组件显示图片 如何用代码修改网站端口号 动态添加gridview BoundField列位置 我是新手,求帮我把这段vs05的代码转换成vs03的 CSDN真是错误百出啊 关于Codebehind 为什么网站在我机器上访问速度正常,而换到另一台服务器却很慢 如何控制浮点型数据的长度 DropDownList和ListBox问题? 有什么好办法让相似的控件执行相同的操作? 谁有免费的数字签名证啊? 菜鸟发问,前辈近来坐坐,有关正则表达的问题 !
{
StringBuilder sb = new StringBuilder(); int attCount = 0;
string filePath = "";
for(int i=0; i< Request.Files.Count; i++)
{
if(Request.Files[i].ContentLength > 0)
{
filePath = Request.Files[i].FileName;
sb.Append("Files" + attCount++ + ": " + filePath + "<br>");
int n = filePath.LastIndexOf("\\");
Request.Files[0].SaveAs(Server.MapPath("./") + filePath.Substring(n+1));
}
} sb.Insert(0, "you upload " + attCount + " files.<br>");
Response.Write(sb.ToString());
}