【问题标题】:I want to upload file to HttpPostedFile which is present in "images" folder of my asp.net website我想将文件上传到我的 asp.net 网站的“图像”文件夹中的 HttpPostedFile
【发布时间】:2014-09-24 23:11:31
【问题描述】:

如何将我的 asp.net 网站的“images”文件夹中的图像分配给 HttpPostedFile?

【问题讨论】:

    标签: asp.net httppostedfile


    【解决方案1】:

    HttpPostedFile 仅由 ASP.NET FileUpload 控件用于上传文件。

    您不能将文件分配给此类,也不能从此类继承,因为它是密封的。

    可以做的是创建一个具有以下属性/功能的类似类:

    public void SaveAs(string filename);
    
    public string FileName { get; set; }
    
    public string ContentType { get; set; }
    
    public int ContentLength { get; set; }
    
    public Stream InputStream { get; set; }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-09-01
      • 2016-05-10
      • 2014-02-20
      • 2023-03-14
      • 1970-01-01
      • 2019-11-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多