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

how to find duplicate item from array using multiple object keys in angular or javascript

 how to find duplicate item from array using multiple object keys There is a way to find based of multiple key find duplicate records in ang...

Popular Posts