HttpPostedFile 和 HttpPostedFileBase

HttpPostedFile HttpPostedFileBase 不存在关系。

     所以我只好,到晚上去找,去查,终于找到了一个好的解决方案,其实它们还是可以通过一个桥梁 HttpPostedFileWrapper 类来转化,HttpPostedFileWrapper : HttpPostedFileBaseHttpPostedFileWrapper 的代码如下:

复制代码
public class HttpPostedFileWrapper : HttpPostedFileBase
{
        // 摘要:
        //     初始化 System.Web.HttpPostedFileWrapper 类的新实例。
        //
        // 参数:
        //   httpPostedFile:
        //     通过此包装类可访问的对象。
        //
        // 异常:
        //   System.ArgumentNullException:
        //     httpApplicationState 为 null。
        public HttpPostedFileWrapper(HttpPostedFile httpPostedFile);
}
复制代码

 

最后解决方案如下:

 public bool UploadFTP(HttpPostedFile file, string strFileType, int iFileLength, int Width, int Height, string Path, ref string strInfo)
{ HttpPostedFileBase hpfb
= new HttpPostedFileWrapper(file) as HttpPostedFileBase; return UploadFTP(hpfb, strFileType, iFileLength, Width, Height, Path, ref strInfo);
posted @ 2014-06-04 17:04  风沙不留痕  阅读(1801)  评论(0编辑  收藏  举报