在C#的应用程序中如何实现文件上传?(网站管理端端)

topfistcn 2002-08-07 06:33:43
在C#的应用程序中如何实现文件上传?此应用程序为一网站管理端的程序
...全文
23 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
topfistcn 2002-08-22
  • 打赏
  • 举报
回复
我要用在应用程序中,你所给出的是一个aspx代码。
bianbiancheng 2002-08-08
  • 打赏
  • 举报
回复
这是我现做的一个程序的一段代码。
String virtualPath = "~/photos/" + this.lblStudentID.Text.Trim()+Path.GetExtension(fileUpLoad.PostedFile.FileName);保存在IIS虚拟路径的photos目录下,用学号来重新命名,扩展名不变。
其中的Path在引用System.IO,fileUpLoad是一个
<INPUT type="file" id="fileUpLoad" name="Upload" runat="server" >

// Calculate physical path of the newly uploaded file
String phyiscalPath = Server.MapPath(virtualPath);

// Save file to uploads directory
fileUpLoad.PostedFile.SaveAs(phyiscalPath);

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧