zoukankan      html  css  js  c++  java
  • 图片上传的例子

    .cs

    private int uploadpic()
      {
      
       if(myFile.PostedFile!=null)
       {
        try
        {
         string fileDir="C://Library//PagePic//"; //注此处可更改为你想要上传的目录
         string fileName=System.IO.Path.GetFileName(myFile.PostedFile.FileName);
         string filePath=System.IO.Path.Combine(fileDir,fileName);
         LfikePath.Text=filePath;
         myFile.PostedFile.SaveAs(filePath);
        }
        catch(Exception exc)
        {
         this.AlertBox(exc.Message);
         return -1;
         
         
        }
       }

       return 0;
      
      
      
      }

     private void BSubmit_Click(object sender, System.EventArgs e)
      {
       
       if(uploadpic()==-1)
       {
       return;
       
       }
       
      }

      

    .aspx

     <<INPUT id="myFile" type="file" onchange="document.all.Ifytp.src=this.value" runat="server">>
    <<asp:image id="Ifytp" runat="server" Width="72px">><</asp:image>>

  • 相关阅读:
    SpringMVC拦截器
    SpringMVC异常
    SpringMVC文件上传
    SpringMVC返回值类型
    JVM字节码
    使用Apache JMeter进行测试
    Tomcat优化
    垃圾收集器
    GC常见算法
    VisualVM远程连接Tomcat
  • 原文地址:https://www.cnblogs.com/superch0054/p/4010264.html
Copyright © 2011-2022 走看看