Ejemplo n.º 1
0
 /// <summary>
 /// 文件上传
 /// </summary>
 /// <param name="fileUpload">FileUpload对象</param>
 /// <param name="saveFolderPath">保存文件的目录</param>
 /// <param name="saveFileName">保存的文件名称</param>
 /// <param name="fileTypes">允许上传文件类型 多个请用英文逗号隔开</param>
 /// <param name="allowedMaxSize">上传文件大小上限 单位:KB</param>
 /// <param name="errors">错误信息</param>
 /// <returns></returns>
 public static string UploadFile(HttpPostedFile fileUpload, string saveFolderPath,
     string saveFileName, string fileTypes, int allowedMaxSize, out string errors)
 {
     mFileUpload fu = new mFileUpload(fileUpload, saveFolderPath, saveFileName, fileTypes, allowedMaxSize);
     if (!saveFolderPath.StartsWith("/") && saveFolderPath.IndexOf("\\") > 0)
     {
         fu.UploadFile();
     }
     else
     {
         fu.UploadFile(saveFolderPath);
     }
     errors = fu.Errors;
     return fu.UploadedFilePath;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 文件上传
 /// </summary>
 /// <param name="postedFile">上传的文件对象</param>
 /// <param name="saveFolderPath">保存文件的目录Url形式的相对目录 如:/upload/test/</param>
 /// <param name="saveFileName">保存的文件名(含扩展名)</param>
 /// <param name="allowedFileTypes">允许上传文件类型 多个请用逗号隔开,如:rar,jpg,gif。 为空或者“*”时将不限上传类型。</param>
 /// <param name="allowedMaxSize">上传文件大小上限 单位:KB</param>
 /// <param name="errors">错误信息</param>
 /// <returns>是否上传成功</returns>
 public static bool UploadFile(HttpPostedFile postedFile, string saveFolderPath, string saveFileName,
     string allowedFileTypes, int allowedMaxSize, out string errors)
 {
     mFileUpload fu = new mFileUpload(postedFile, saveFolderPath, saveFileName, allowedFileTypes, allowedMaxSize);
     bool results = fu.UploadFile();
     errors = fu.Errors;
     return results;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 文件上传
 /// </summary>
 /// <param name="fileUpload">FileUpload对象</param>
 /// <param name="saveFolderPath">保存文件的目录</param>
 /// <param name="saveFileName">保存的文件名称</param>
 /// <param name="fileTypes">允许上传文件类型 多个请用英文逗号隔开</param>
 /// <param name="allowedMaxSize">上传文件大小上限 单位:KB</param>
 /// <param name="errors">错误信息</param>
 /// <returns></returns>
 public static string UploadFile(HtmlInputFile fileUpload, string saveFolderPath,
     string saveFileName, string fileTypes, int allowedMaxSize, out string errors)
 {
     mFileUpload fu = new mFileUpload(fileUpload.PostedFile, saveFolderPath, saveFileName, fileTypes, allowedMaxSize);
     fu.UploadFile();
     errors = fu.Errors;
     return fu.UploadedFilePath;
 }