How To Convert HttpPostedFileBase To HttpPostedFile in c#


How To Convert HttpPostedFileBase To HttpPostedFile in c#




Here We Need To Convert HttpPostedFileBase To HttpPostedFile using C# , asp.net MVC

using System;
using System.Configuration;
using System.Data;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.Mvc;

using System.Collections.Generic;

namespace myProject
{
    public static class Utils

    {
public static HttpPostedFile HttpPostedFileBaseToHttpPostedFile(HttpPostedFileBase file)
        {
            var constructorInfo = typeof(HttpPostedFile).GetConstructors(BindingFlags.NonPublic | BindingFlags.Instance)[0];
            var obj = (HttpPostedFile)constructorInfo
                      .Invoke(new object[] { file.FileName, file.ContentType, file.InputStream });
            return obj;
        }
}

No comments:

Post a comment

Thank You For Your Great Contribution

Featured Post

Asp.net And HTML Css And Web Development: How to convert Dot net sql date / Date string to L...

Asp.net And HTML Css And Web Development: How to convert Dot net sql date / Date string to L... : How to convert Dot net sql date / Date str...

Popular Posts