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 post formdata or http.context.form data from angular 6 to asp.net mvc web api or api using Token based authentication with header

how to post formdata or http.context.form data from angular 6 to asp.net mvc web api or api using Token based authentication with header  ...

Popular Posts