public void Upload() { ////HttpPostedFile MyFile = Request.Files["MyFile"]; //string fileName = Path.GetFileName(UploadResume.PostedFile.FileName); ViewState["FilePath"] = ""; //for (int i = 0; i < Request.Files.Count; i++) //{ // var myFile = Request.Files[i]; // if (myFile != null && myFile.ContentLength != 0) // { // pathForSaving = Server.MapPath("~/uploadedfiles/"); // string pathForSavingFile = "/uploadedfiles/"; // try // { // string strFileNameOnly = CommonFn.GetFileName(myFile.FileName); // ViewState["FilePath"] = Path.Combine(pathForSavingFile, strFileNameOnly); // string strFileName= Path.Combine(pathForSavingFile, strFileNameOnly); // MyFile = Request.Files[CommonFn.GetFileName(myFile.FileName)]; // MyFile.SaveAs(Path.Combine(pathForSaving, strFileName)); // } // catch (Exception ex) // { // } // } //} string strDBImagePath = string.Empty; try { if (UploadResume.HasFile) { string strServerPath = Server.MapPath(CommonFn.Image_Save_Path); string strSaveImagePath = string.Empty; string fileName = Path.GetFileName(UploadResume.PostedFile.FileName); string FolderName = CommonFn.UploadedResumeFolder; string strFileNameOnly = CommonFn.GetFileName(fileName); strSaveImagePath = strServerPath + FolderName + "\\" + strFileNameOnly; UploadResume.SaveAs(strSaveImagePath); strDBImagePath = CommonFn.DbSave + CommonFn.DbUploadedResume; strDBImagePath = strDBImagePath + strFileNameOnly; ViewState["FilePath"] = strDBImagePath; } } catch (Exception ex) { } }
public async Task <Unit> Handle(CreateCandidateCommand request, CancellationToken cancellationToken) { // Resume Code request.ResumeLink = UploadResume.uploadResumeDoc(_context.ftpPath, request.FileName, request.Resume, _context.ftpUserName, _context.ftpPassword); var entity = new Candidate { //Id = request.Id, Name = request.Name, DateOfBirth = request.DateOfBirth, Email = request.Email, Mobile = request.Mobile, ResumePath = request.ResumeLink }; _context.Add(entity); return(Unit.Value); }