1

How to assign image present in "images" folder of my asp.net website to HttpPostedFile?

1 Answers1

0

HttpPostedFile is simply used by the ASP.NET FileUpload control by uploaded files only.

You can't assign a file to this class nor can you inherit from this class since it's sealed.

What you can do though, is create a similar class that has the following properties/functions:

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; }
Saturn K
  • 2,705
  • 4
  • 26
  • 38