Beispiel #1
0
        /// <summary>
        /// 资料上传
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static List <IES.Resource.Model.File> ResourceFileUpload(IES.Resource.Model.File model)
        {
            HttpFileCollection             files            = HttpContext.Current.Request.Files;
            List <IES.Resource.Model.File> resourcefilelist = new List <IES.Resource.Model.File>();

            for (int i = 0; i < files.Count; i++)
            {
                IESFile file = Upload(files[i]);
                if (file.FileGuid != null && file.FileGuid != string.Empty)
                {
                    if (RemoteFileExists(file))
                    {
                        FileBLL bll = new FileBLL();
                        file.FileType = file.GetFileType();
                        IES.Resource.Model.File resourcefile = new IES.Resource.Model.File
                        {
                            FileName       = file.FileName,
                            ServerID       = file.ServerID,
                            FileSize       = file.FileSize,
                            FileTitle      = file.FileTitle,
                            OCID           = model.OCID,
                            FolderID       = model.FolderID,
                            CourseID       = model.CourseID,
                            CreateUserID   = UserService.CurrentUser.UserID,
                            CreateUserName = UserService.CurrentUser.UserName,
                            Ext            = file.Ext,
                            FileType       = file.FileType,
                            ShareRange     = model.ShareRange
                        };
                        resourcefile = bll.File_ADD(resourcefile);
                        if (resourcefile.FileID > 0)
                        {
                            resourcefilelist.Add(resourcefile);
                        }
                    }
                }
            }
            return(resourcefilelist);
        }