Beispiel #1
0
        public async Task <IActionResult> Upload(UploadVM uploadVM)
        {
            if (ModelState.IsValid)
            {
                Image newImage = new Image()
                {
                    Title    = uploadVM.Title,
                    Created  = DateTime.Now,
                    ImageUrl = "/images/gallery/" + uploadVM.ImageUploaded.FileName
                };
                if (uploadVM.ImageUploaded != null && uploadVM.ImageUploaded.Length > 0)
                {
                    string path = Path.Combine(_webHostEnvironment.ContentRootPath, "wwwroot\\images\\gallery\\", uploadVM.ImageUploaded.FileName);

                    using (var fStream = new FileStream(path, FileMode.Create))
                    {
                        await uploadVM.ImageUploaded.CopyToAsync(fStream);
                    }
                }
                _imageService.AddImage(newImage);

                TempData["message"] = $"Image \"{uploadVM.Title}\" has benn added to gallery";
                return(RedirectToAction("Index", "Gallery"));
            }
            else
            {
                return(View(uploadVM));
            }
        }
Beispiel #2
0
 public CollectionsVM(
     CollectionsFABButtonVM fabPlusButtonVM,
     UploadVM uploadVM,
     TagVM tagVM,
     TagImageDialogVM tagImageDialogVM,
     SearchBoxVM searchBoxVM,
     TagDropDownMenuVM tagDropdownMenuVM,
     SortDropdownMenuVM sortDropdownMenuVM,
     DeleteConfirmationBarVM deleteConfirmationVM,
     ImageViewerVM imageViewerVM,
     ProjectService projectService,
     TagsService tagsService)
 {
     State = CollectionsState.Main;
     CollectionsFABButtonVM = fabPlusButtonVM;
     UploadVM                    = uploadVM;
     TagImageDialogVM            = tagImageDialogVM;
     TagVM                       = tagVM;
     SearchBoxVM                 = searchBoxVM;
     SearchBoxVM.HasErrorMessage = true;
     SearchBoxVM.ErrorMessage    = "No search results";
     SearchBoxVM.PlaceHolderText = "Search by name";
     TagDropdownMenuVM           = tagDropdownMenuVM;
     SortDropdownMenuVM          = sortDropdownMenuVM;
     DeleteConfirmationBarVM     = deleteConfirmationVM;
     ImageViewerVM               = imageViewerVM;
     ProjectService              = projectService;
     TagsService                 = tagsService;
     RegisterEvents();
     ImageThumbnails = new ObservableCollection <ImageThumbnailCollectionsVM>();
 }
Beispiel #3
0
        public IHttpActionResult UploadImage([FromBody] UploadVM dataRequest)
        {
            try
            {
                var server  = HttpContext.Current.Server;
                var dirName = $"Upload/{dataRequest.AccountID.ToString()}/{dataRequest.BranchID.ToString()}";
                var root    = $"{VNPTConfigs.DirRootUpload}/{dirName}";
                //server.MapPath(@"~/" + dirName);
                if (!Directory.Exists(root))
                {
                    Directory.CreateDirectory(root);
                }
                var result = dataRequest.Base64String.Substring(dataRequest.Base64String.LastIndexOf(',') + 1);
                var img    = VNPTHelper.Base64ToImage(result);
                img.Save($"{root}/{dataRequest.FileName}");

                return(Json(new TResult()
                {
                    Status = (int)EStatus.Ok,
                    Data = $"{dirName}/{dataRequest.FileName}"
                }));
            }
            catch (Exception e)
            {
                this.VNPTLogs.Write(this.RepositoryLog, e.Message);
                return(Json(new TResult()
                {
                    Status = (short)EStatus.Fail,
                    Msg = e.Message
                }));
            }
        }
Beispiel #4
0
        public ActionResult googleDrive(UploadVM member)
        {
            int  userID = Convert.ToInt32(HttpContext.Session["UserID"]);
            User user   = db.Users.Where(p => p.User_ID == userID).FirstOrDefault();

            if (user == null)
            {
                ModelState.AddModelError("uploadFile", "You must be Logged in to do that!");
                return(View(member));
            }

            foreach (HttpPostedFileBase file in member.uploadFile)
            {
                if (file == null)
                {
                    ModelState.AddModelError("uploadFile", "Please select a file.");
                    return(View(member));
                }
                string extension = Path.GetExtension(file.FileName);

                if (extension == ".pdf")
                {
                    string finalPath = "\\UploadedFiles\\Resources\\" + user.Username + " - " + Path.GetFileName(file.FileName);
                    file.SaveAs(Server.MapPath("~") + finalPath);
                    member.Upload = finalPath;
                }
                else
                {
                    ModelState.AddModelError("uploadFile", "PDF ONLY! Thank you.");
                    return(View(member));
                }
            }

            return(RedirectToAction("ThankyouUpload"));
        }
        public ActionResult SelectTypes(UploadVM vm)
        {
            if (TempData["ViewData"] != null)
            {
                ViewData = (ViewDataDictionary)TempData["ViewData"];
            }

            if (vm.File.ContentLength > 11000000)
            {
                ModelState.AddModelError(string.Empty, "*There is a 10MB size limit at this time");
                TempData["ViewData"]   = ViewData;
                TempData["ModelState"] = ModelState;
                return(RedirectToAction("Upload"));
            }



            if (vm.File.ContentLength > 0 && ModelState.IsValid)
            {
                var          guid         = Guid.NewGuid();
                var          path         = Path.Combine(Server.MapPath("~/Content/Files"), guid.ToString());
                SelectTypeVM selectTypeVM = Methods.MakeSelectType(vm, path);
                selectTypeVM.FileName = vm.File.FileName;
                return(View(selectTypeVM));
            }
            else
            {
                return(RedirectToAction("Upload"));
            }
        }
Beispiel #6
0
        public ActionResult Upload()
        {
            if (TempData["ViewData"] != null)
            {
                ViewData = (ViewDataDictionary)TempData["ViewData"];
            }

            UploadVM file = new UploadVM();

            return(View(file));
        }
Beispiel #7
0
        public ActionResult Upload(UploadVM model, IEnumerable <HttpPostedFileBase> files)
        {
            FileData fileData = new FileData();

            //if found the same file redirect to the show Action

            try
            {
                foreach (var file in files)
                {
                    if (file != null && file.ContentLength > 0)
                    {
                        //create FileData object to hold all file paths
                        fileData = new FileData(file.FileName);

                        if (IfcHandler.CheckFileExist(fileData.InputPath))
                        {
                            //return PartialView(@"~/Views/Files/Show.cshtml", fileData);
                        }
                        //write the file to the desk
                        file.SaveAs(fileData.InputPath);

                        //send the input data to the database
                        UnitOfWork uow = new UnitOfWork(new AlgorithmDB());
                        model.FileName = file.FileName;

                        var proj = new Project()
                        {
                            Id          = Guid.NewGuid(),
                            Title       = model.Title,
                            Description = model.Desciption,
                            FileName    = model.FileName,
                            UserId      = User.Identity.GetUserId()
                        };
                        uow.Projects.Insert(proj);
                        uow.SaveChanges();
                        //send the data Model to the Show Action
                        // return PartialView(@"~/Views/Files/Show.cshtml", fileData);

                        RedirectToAction("Index", "DashBoard", new { Id = proj.Id });
                    }
                }

                Response.StatusCode = (int)HttpStatusCode.OK;
            }
            catch (Exception)
            {
                return(View());
            }


            return(RedirectToAction("Show", "Files", fileData));
        }
        public ActionResult Upload()
        {
            if (TempData["ViewData"] != null)
            {
                ViewData = (ViewDataDictionary)TempData["ViewData"];
            }
            //if (TempData["ModelState"] != null)
            //    TempData["ModelState"] = ModelState;

            UploadVM file = new UploadVM();

            return(View(file));
        }
Beispiel #9
0
        public IHttpActionResult Image([FromBody] UploadVM dataRequest)
        {
            try
            {
                string imageNm = null;
                //convert GUID to string with AccountID
                string AccountIDText = dataRequest.AccountID.ToString();

                //get image
                if (!string.IsNullOrEmpty(dataRequest.Base64String))
                {
                    string pathSaveImage = string.Format(Constants.LBM_PATH_SAVE_FILE_TMP, AccountIDText);
                    imageNm = VNPTHelper.SaveBase64ToImage(dataRequest.Base64String, pathSaveImage);
                    if (imageNm.Equals(EStatusFile.OverWeight.ToString()))
                    {
                        string errorMsg = string.Format(VNPTResources.Instance.Get(
                                                            VNPTResources.ID.MsgErrorImageUrlMaxSize), VNPTHelper.ConvertBytesToMegabytes(
                                                            Constants.LBM_MAX_SIZE_IMAGE));
                        return(Json(new TResult()
                        {
                            Status = (short)EStatus.Fail,
                            Data = errorMsg
                        }));
                    }
                    else if (imageNm.Equals(EStatusFile.Base64Incorrect.ToString()))
                    {
                        string errorMsg = VNPTResources.Instance.Get(VNPTResources.ID.MsgErrorBase64Incorrect);
                        return(Json(new TResult()
                        {
                            Status = (short)EStatus.Fail,
                            Msg = errorMsg
                        }));
                    }
                }

                return(Json(new TResult()
                {
                    Status = (short)EStatus.Ok,
                    Data = imageNm
                }));
            }
            catch (Exception e)
            {
                this.VNPTLogs.Write(this.Repository, e.Message);
                return(Json(new TResult()
                {
                    Status = (short)EStatus.Fail,
                    Msg = e.Message
                }));
            }
        }
Beispiel #10
0
        public async Task <IActionResult> DropzoneUploadFile(UploadVM vm)
        {
            string webRootPath = _hostingEnvironment.WebRootPath;

            try
            {
                if (vm.file.Length > 0)
                {
                    var orgFileName = Path.GetFileNameWithoutExtension(vm.file.FileName);
                    var ex          = Path.GetExtension(vm.file.FileName);
                    //string filename = ImageHandler.GetRandomFileName(Path.GetExtension(iFormFile.FileName), 10000);
                    string localPath = webRootPath + (string.IsNullOrEmpty(vm.filePath) ? _rootDirectory.Replace('/', '\\') : vm.filePath.Replace('/', '\\'));

                    if (!Directory.Exists(localPath))
                    {
                        Directory.CreateDirectory(localPath);
                    }
                    string fileName = FileHelper.GetFileName(orgFileName, localPath, ex);

                    string saveFilePath = Path.Combine(localPath, fileName);

                    var    oldstr     = "wwwroot" + _rootDirectory.Replace('/', '\\');
                    var    newstr     = "wwwroot" + _tempDirectory.Replace('/', '\\');
                    string _thumbPath = saveFilePath.Replace(oldstr, newstr);

                    using (var stream = new FileStream(saveFilePath, FileMode.Create))
                    {
                        await vm.file.CopyToAsync(stream);
                    }
                    //   ImageHandler.MakeThumbnail2(saveFilePath, _thumbPath, 120, 90, "DB", ex.ToLower());
                    if (ex.ToLower() == ".jpg" || ex.ToLower() == ".png" || ex.ToLower() == ".gif")
                    {
                        ImageHandler.MakeThumbnail2(saveFilePath, _thumbPath, _thumbWidth, _thumbHeight);
                    }
                }

                return(StatusCode(StatusCodes.Status200OK, "文件成功上传! "));
            }
            catch (Exception er)
            {
                return(BadRequest(new { success = false, message = "文件上传失败:" + er.Message }));
            }
        }
        public ActionResult Upload(UploadVM upload)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    bool isUploaded = false;

                    if (upload.Content != null)
                    {
                        isUploaded = resumeService.UploadResume(User.Identity.Name, upload.Content.FileName, upload.Description, upload.Content);
                    }

                    var vm = new UploadVM()
                    {
                        Notification = new NotificationVM()
                        {
                            Message = isUploaded ? "Success" : "Resume upload failed",
                            Type    = isUploaded ? NotificationType.Success : NotificationType.Error
                        }
                    };

                    return(PartialView("~/Views/Resume/UploadPartial.cshtml", vm));
                }
                else
                {
                    return(PartialView("~/Views/Resume/UploadPartial.cshtml", upload));
                }
            }
            catch (Exception ex)
            {
                logger.Log(LogType.Error, "Resume upload failed", ex);
                var vm = new UploadVM()
                {
                    Notification = new NotificationVM()
                    {
                        Message = "Upload could not be completed.",
                        Type    = NotificationType.Error
                    }
                };
                return(PartialView("~/Views/Resume/UploadPartial.cshtml", vm));
            }
        }
Beispiel #12
0
        public ActionResult <object> PostBase64([FromBody] ImageVM imageVM)
        {
            UploadVM upload = new UploadVM();

            try
            {
                string baseDirectory = AppContext.BaseDirectory;


                String Tpath    = Path.Combine("resources", DateTime.Now.ToString("yyyyMMddHH"));
                string name     = "picBase64.jpg";
                string FileName = DateTime.Now.ToString("yyyyMMddHHmmssfff");
                string FilePath = Path.Combine(baseDirectory, Tpath);

                string        fileType = System.IO.Path.GetExtension(name);
                DirectoryInfo di       = new DirectoryInfo(FilePath);


                if (!di.Exists)
                {
                    di.Create();
                }

                byte[]       bit = Convert.FromBase64String(imageVM.ImgBase64);
                MemoryStream ms  = new MemoryStream(bit);
                Bitmap       bmp = new Bitmap(ms);

                bmp.Save(Path.Combine(FilePath, FileName + fileType), ImageFormat.Jpeg);


                upload.fileName = name;
                upload.filePath = Path.Combine(Tpath, FileName + fileType);
                upload.fileType = fileType;
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.ToJson());
                throw ex;
            }
            return(upload.ResponseSuccess());
        }
Beispiel #13
0
        public UploadPdf Upload([FromForm] UploadVM vm)
        {
            var uploadService = new UploadPdf();

            if (vm.pdf == null)
            {
                throw new Exception("File is null");
            }
            if (vm.pdf.Length == 0)
            {
                throw new Exception("File is empty");
            }

            using (Stream stream = vm.pdf.OpenReadStream())
            {
                using (var binaryReader = new BinaryReader(stream))
                {
                    var fileContent = binaryReader.ReadBytes((int)vm.pdf.Length);
                    uploadService.AddFile(fileContent, vm.pdf.FileName, vm.pdf.ContentType);
                }
            }
            return(uploadService);
        }
Beispiel #14
0
        public IHttpActionResult UploadFile([FromBody] UploadVM dataRequest)
        {
            try
            {
                var server  = HttpContext.Current.Server;
                var dirName = $"Upload/{dataRequest.AccountID.ToString()}/{dataRequest.BranchID.ToString()}";
                // normalize URI string. if exists redundant slash, remove it
                if (dirName.ElementAt(dirName.Length - 1).Equals('/'))
                {
                    dirName = dirName.Substring(0, dirName.Length - 1);
                }

                var root = $"{VNPTConfigs.DirRootUpload}/{dirName}";
                //server.MapPath(@"~/" + dirName);
                if (!Directory.Exists(root))
                {
                    Directory.CreateDirectory(root);
                }

                Byte[] bytes = Convert.FromBase64String(dataRequest.Base64String);
                File.WriteAllBytes($"{root}/{dataRequest.FileName}", bytes);
                return(Json(new TResult()
                {
                    Status = (int)EStatus.Ok,
                    Data = $"{dirName}/{dataRequest.FileName}"
                }));
            }
            catch (Exception e)
            {
                this.VNPTLogs.Write(this.RepositoryLog, e.Message);
                return(Json(new TResult()
                {
                    Status = (short)EStatus.Fail,
                    Msg = e.Message
                }));
            }
        }
        public SelectTypeVM MakeSelectType(UploadVM vm, string path)
        {
            var fileName = Path.GetFileName(vm.File.FileName);

            vm.File.SaveAs(path);

            SelectTypeVM selectTypeVM = new SelectTypeVM();

            selectTypeVM.Path        = path;
            selectTypeVM.ColumnTypes = new Dictionary <string, string>();

            string line1 = File.ReadLines(selectTypeVM.Path).First();

            string[] values = line1.Split(',');

            for (var i = 0; i < values.Length; i++)
            {
                selectTypeVM.ColumnTypes.Add(values[i].Replace("\"", ""), "");
            }

            MakeDropDownAndFirstFive(selectTypeVM);

            return(selectTypeVM);
        }
Beispiel #16
0
        public ActionResult googleDrive()
        {
            UploadVM member = new UploadVM();

            return(View("googleDrive", member));
        }
 public ActionResult ChooseAnalysis(UploadVM vm)
 {
     return(View());
 }
        public ActionResult GetUpload()
        {
            var vm = new UploadVM();

            return(PartialView("~/Views/Resume/UploadPartial.cshtml", vm));
        }
Beispiel #19
0
        public ActionResult Upload(int?courseId, int?moduleId, int?activityId, int?assignmentDocId, int?purposeId, DateTime?deadLine, string returnTo)
        {
            returnTo = Request.ServerVariables["HTTP_REFERER"];
            var purposes = db.Purposes.ToList().ConvertAll(d => new SelectListItem
            {
                Text     = d.Name,
                Value    = $"{d.Id}",
                Selected = purposeId != null ? purposeId == d.Id ? true : false : false,
            });

            var vm = new UploadVM
            {
                CourseId        = courseId,
                ModuleId        = moduleId,
                ActivityId      = activityId,
                PurposeId       = purposeId ?? 1,
                Purposes        = purposes,
                ReturnTo        = returnTo,
                DeadLine        = deadLine,
                AssignmentDocId = assignmentDocId ?? 0
            };

            if (activityId != null)
            {
                var activity = db.Activities.Find(activityId);
                vm.ActivityName = activity.Name;
                // Try to fill in deadline right awayy
                if (User.IsInRole("Student"))
                {
                    if (activity.ActivityTypeId == 5) //exercise
                    {
                        //locate the assignemnt description for this exercise
                        var doc = db.Documents
                                  .Where(d => d.ActivityId == activityId)
                                  .Where(d => d.PurposeId == 5)
                                  .FirstOrDefault();
                        if (doc != null)
                        {
                            vm.DeadLine  = doc.DeadLine;
                            vm.PurposeId = 7; //student hand-in
                        }
                    }
                }
                moduleId = activity.ModuleId;
            }

            if (moduleId != null)
            {
                var module = db.Modules.Find(moduleId);
                vm.ModuleName = module.Name;
                courseId      = module.CourseId;
            }
            if (courseId != null)
            {
                var course = db.Courses.Find(courseId);
                vm.CourseName = course.Name;
            }
            ViewBag.ReturnUrl = returnTo;
            ViewBag.PurposeId = purposes;
            return(View(vm));
        }
Beispiel #20
0
        public ActionResult Upload([Bind(Include = "CourseId,ModuleId,ActivityId,PurposeId,AssignmentDocId,DeadLine,ReturnTo")] UploadVM vm, HttpPostedFileBase uploadFile)
        {
            // Verify that the user selected a file
            if (uploadFile != null && uploadFile.ContentLength > 0)
            {
                //Trim off possible path info from IE clients
                string fileName = Path.GetFileName(uploadFile.FileName);

                //obtain a local path to our uploads folder
                var path = Server.MapPath("~/uploads");

                //ensure it exists
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }

                path = Path.Combine(path, fileName);

                // try to find the mime type for this file.
                var mimeType = db.MimeTypes
                               .Where(mt => mt.Name == uploadFile.ContentType)
                               .FirstOrDefault();

                if (mimeType == null)
                {
                    //this gives us "applciation/octet-stream", which is a good default compromise
                    mimeType = db.MimeTypes
                               .Where(mt => mt.DefaultExtension == "")
                               .FirstOrDefault();
                }

                // Avoid collision with already uploaded files
                int    fileIndex = 0;
                string basePath;
                string extension = Path.GetExtension(fileName);

                if (extension != null && extension.Length > 0)
                {
                    basePath = path.Substring(0, path.LastIndexOf("."));
                }
                else
                {
                    basePath  = path;
                    extension = mimeType.DefaultExtension;
                    if (extension.Length == 0)
                    {
                        extension = "bin";
                        fileName += ".bin";
                    }
                }

                while (System.IO.File.Exists(path))
                {
                    path = $"{basePath}({++fileIndex}).{extension}";
                }

                //  And, try to save. Watch for problems.
                try
                {
                    uploadFile.SaveAs(path);
                }
                catch (IOException e)
                {
                    ModelState.AddModelError("", e.Message);
                }

                if (ModelState.IsValid)
                {
                    //if we get here, we probably managed to save the thing.
                    //now, to create a record for it.

                    //Since we may have renamed the file, we cannot rely
                    //on the submitted filename.
                    if (fileIndex > 0)
                    {
                        fileName = Path.GetFileName(path);
                    }

                    var doc = new Document
                    {
                        Filename        = fileName,
                        FileSize        = uploadFile.ContentLength,
                        FileType        = uploadFile.ContentType,
                        MimeTypeId      = mimeType.Id,
                        OwnerId         = User.Identity.GetUserId(),
                        DateUploaded    = DateTime.Now,
                        PurposeId       = vm.PurposeId,
                        ActivityId      = vm.ActivityId,
                        ModuleId        = vm.ModuleId,
                        CourseId        = vm.CourseId,
                        AssignmentDocId = vm.AssignmentDocId,
                        DeadLine        = vm.DeadLine,
                    };

                    if (User.IsInRole("Teacher"))
                    {
                        //Teacher uploads get a status of Issued by default
                        doc.Status   = db.Statuses.FirstOrDefault();
                        doc.StatusId = doc.Status.Id;
                    }
                    else if (User.IsInRole("Student"))
                    {
                        /* Student can only upload hand-ins.
                         * They are submissions by definition */
                        doc.PurposeId = 7;  //student hand-in
                        doc.StatusId  = 3;  //submitted
                        doc.Status    = db.Statuses.Find(3);
                        doc.Purpose   = db.Purposes.Find(7);

                        /* Find any Exercise description asosciated with this view.*/
                        var assignment = db.Documents
                                         .Where(e => (e.PurposeId == 5) && (e.ActivityId == doc.ActivityId))
                                         .FirstOrDefault();
                        if (assignment != null)
                        {
                            doc.DeadLine = assignment.DeadLine;
                        }
                    }
                    db.Documents.Add(doc);
                    db.SaveChanges();

                    TempData["Message"] = $"File {fileName} received!";

                    if (vm.ReturnTo != null)
                    {
                        return(Redirect(vm.ReturnTo));
                    }

                    return(RedirectToAction("Index", "Home"));
                }
            }
            else
            {
                ModelState.AddModelError("", "You forgot to select a file.");
            }
            var purposes = db.Purposes.ToList().ConvertAll(d => new SelectListItem
            {
                Text     = d.Name,
                Value    = $"{d.Id}",
                Selected = (vm.PurposeId == d.Id)
            });

            ViewBag.PurposeId = purposes;
            return(View(vm));
        }
Beispiel #21
0
 private void FabPlusButtonVM_OnUploadClicked(object sender, EventArgs e)
 {
     State = CollectionsState.Upload;
     UploadVM.Reset();
     CollectionsFABButtonVM.IsOpen = false;
 }
Beispiel #22
0
        public ActionResult <object> Post([FromForm] IFormCollection formCollection, string picMode = "")
        {
            UploadVM upload = new UploadVM();

            try
            {
                string baseDirectory = AppContext.BaseDirectory;

                FormFileCollection filelist = (FormFileCollection)formCollection.Files;

                foreach (IFormFile file in filelist)
                {
                    String Tpath = Path.Combine("resources", DateTime.Now.ToString("yyyyMMddHH"));
                    string name  = file.FileName;
                    //string FileName = DateTime.Now.ToString("yyyyMMddHHmmssfff");
                    string FileName = Guid.NewGuid().ToString("N").ToLower();
                    string FilePath = Path.Combine(baseDirectory, Tpath);

                    string        fileType = System.IO.Path.GetExtension(name);
                    DirectoryInfo di       = new DirectoryInfo(FilePath);


                    if (!di.Exists)
                    {
                        di.Create();
                    }
                    string fullFile = Path.Combine(FilePath, FileName + fileType);

                    using (FileStream fs = System.IO.File.Create(fullFile))
                    {
                        // 复制文件
                        file.CopyTo(fs);
                        // 清空缓冲区数据
                        fs.Flush();
                    }

                    string newFullFile = "";
                    switch (picMode)
                    {
                    //缩略图
                    case "Thumbnail":
                        //FileName = DateTime.Now.ToString("yyyyMMddHHmmssfff");
                        FileName    = Guid.NewGuid().ToString("N").ToLower();
                        newFullFile = Path.Combine(FilePath, FileName + fileType);
                        Util.ImagePro.MakeThumNail(fullFile, newFullFile, 350, 350, "W");
                        break;

                    //详情图
                    case "Details":
                        FileName = Guid.NewGuid().ToString("N").ToLower();
                        //FileName = DateTime.Now.ToString("yyyyMMddHHmmssfff");
                        newFullFile = Path.Combine(FilePath, FileName + fileType);
                        Util.ImagePro.MakeThumNail(fullFile, newFullFile, 800, 800, "W");
                        break;

                    //原图
                    case "OriginalGraph":
                    case "":
                        break;
                    }

                    upload.fileName = name;
                    upload.filePath = Path.Combine(Tpath, FileName + fileType);
                    upload.fileType = fileType;
                }
            }
            catch
            {
            }

            return(upload.ResponseSuccess());
        }
Beispiel #23
0
        public IActionResult Upload()
        {
            UploadVM vm = new UploadVM();

            return(View(vm));
        }