zoukankan      html  css  js  c++  java
  • .net:上传图片并将保存至指定目录下(支持PC端和移动端)

    页面:

    <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 "未选择图片!";
      }
    }
  • 相关阅读:
    监控Nginx
    监控Tomcat
    监控memcache
    监控Redis
    14-SpringCloud Bus
    13-SpringCloud Config
    12-SpringCloud GateWay
    11-SpringCloud Hystrix
    10-SpringCloud OpenFeign
    09-SpringCloud Ribbon
  • 原文地址:https://www.cnblogs.com/Cchblogs/p/6048139.html
Copyright © 2011-2022 走看看