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 sent authorized header attribute value using c# .net httpclient for third party api call of oauth 2.0

How to sent authorized header attribute value using C# .NET HTTP client for third party API call of OAuth 2.0 For call token From Authorized...

Popular Posts