页面:

<body>
  <form id="formid" name="myform" action="Upload" method='post' enctype="multipart/form-data">
    <table>
      <tr>
        <td>图片:</td>
        <td><input type="file" name="file" accept="image/*" value="选择" /></td>
      </tr>
    </table>
    <input type="submit" value="上传" />
  </form>
</body>

后台:

public string Upload()
{
  HttpPostedFileBase file = Request.Files["file"];
  if (file.ContentLength > 0)
  {
    string savePath = Server.MapPath("~/Uploads/Pictures");
    string failPath = savePath + "\\" + file.FileName;
    file.SaveAs(failPath);
    return “图片上传成功!”;
  }
  else
  {
    return "未选择图片!";
  }
}

最新文章

  1. Be careful about the upper limit of integer
  2. [Unity3d插件]EasyTouch的初步使用
  3. web工程spring+ibatis单元测试
  4. WPF快速入门系列(1)——WPF布局概览
  5. 如何通过js实现图片预览功能
  6. PHP闭包研究
  7. CSS Layout
  8. android学习之BUG——The connection to adb is down, and a severe error has occured.
  9. CentOS安装最新的Mysql版本
  10. JAVA – 虚函数、抽象函数、抽象类、接口
  11. 使用gc、objgraph干掉python内存泄露与循环引用!
  12. round()函数 浮点数的四舍五入
  13. CentOS-7修改主机名
  14. 爬取豆瓣电影影评,生成wordcloud词云,并利用监督学习根据评论自动打星
  15. JS膏集02
  16. 20155305《网络对抗》PC平台逆向破解(二)
  17. Razor视图引擎 语法学习
  18. windows server 2008 修改域的密码策略
  19. SQL语句中的TOP(expression) [PERCENT] [WITH TIES] 用法
  20. Java SE练习题——求奇数

热门文章

  1. C0304 备份最后一天所有修改的文件
  2. C++ 类的多态三(多态的原理--虚函数指针--子类虚函数指针初始化)
  3. checkbox 更新回显
  4. 在项目中用过Spring的哪些方面?及用过哪些Ajax框架?
  5. Linux下搜索文件find、which、whereis、locate
  6. Java知识点梳理——多态
  7. OpenvSwitch自动化重新编译和安装
  8. 在VerilogHDL中调用VHDL的模块
  9. 关于小程序报错 缺少文件,错误信息:error: iconPath=../images/home.png, file not found
  10. druid