/// <summary>
 /// 文件上传
 /// </summary>
 /// <param name="httpUrl">上传 URL</param>
 /// <param name="httpPostedFile">转发 HttpPostedFile</param>
 /// <param name="httpPostedFileName">HttpPostedFile 名称</param>
 /// <param name="parameterList">参数列表</param>
 /// <param name="cookieContainer">CookieContainer</param>
 /// <param name="timeout">超时</param>
 /// <returns></returns>
 public static string Upload(string httpUrl, System.Web.HttpPostedFileBase httpPostedFile, string httpPostedFileName = "file", Dictionary <string, object> parameterList = null, CookieContainer cookieContainer = null, int timeout = 20000)
 {
     return(UploadItem(httpUrl, (byte[] buffer) =>
     {
         httpPostedFile.InputStream.Read(buffer, 0, buffer.Length);
     }, httpPostedFile.FileName, httpPostedFile.ContentLength, httpPostedFile.ContentType, httpPostedFileName, parameterList, cookieContainer, timeout));
 }
        public ActionResult Create(Customer customer, FullName name, FullAddress ha, System.Web.HttpPostedFileBase image)
        {
            if (ModelState.IsValid)
            {
                customer.ID          = Guid.NewGuid();
                ha.ID                = Guid.NewGuid();
                customer.Name        = name;
                customer.HomeAddress = ha;
                ha.PersonID          = customer.ID;

                if (image != null)
                {
                    System.IO.Stream imgStream = image.InputStream;
                    int    size     = (int)imgStream.Length;
                    byte[] imgBytes = new byte[size];
                    imgStream.Read(imgBytes, 0, size);
                    customer.Picture = imgBytes;
                }
                else
                {
                    customer.Picture = new byte[] { 0 };
                }

                BranchContext branchDb = new BranchContext("b-" + customer.BranchID);
                branchDb.Customers.Add(customer);
                branchDb.FullAddresses.Add(ha);
                branchDb.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.BranchID = new SelectList(db.Branches, "ID", "Name", customer.BranchID);
            ViewBag.ID       = new SelectList(db.FullNames, "ID", "Title", customer.ID);
            return(View(customer));
        }
Esempio n. 3
0
        public ContentResult UploadFiles()
        {
            List <UploadFilesResult> r = new List <UploadFilesResult>();

            foreach (string file in Request.Files)
            {
                System.Web.HttpPostedFileBase hpf = Request.Files[file];
                if (hpf.ContentLength == 0)
                {
                    continue;
                }

                string savedFileName = Path.Combine(Server.MapPath("~/Content"), Path.GetFileName(hpf.FileName));
                hpf.SaveAs(savedFileName);

                r.Add(new UploadFilesResult
                {
                    Name   = hpf.FileName,
                    Length = hpf.ContentLength,
                    Type   = hpf.ContentType
                });
            }

            return(Content(
                       "{\"name\":\"" + r[0].Name + "\",\"type\":\"" + r[0].Type + "\",\"size\":\"" +
                       string.Format("{0} bytes", r[0].Length) + "\"}", "application/json"));
        }
        private DataTable ConvertRCPAExcelToDataTable(System.Web.HttpPostedFileBase postedFile)
        {
            IFileProvider fileProvider  = new FileSystemProvider();
            IExcelFactory excelFactory  = new ExcelFactory();
            CurrentInfo   objCurInfo    = new CurrentInfo();
            string        containerName = objCurInfo.GetCompanyCode().ToLower();
            string        fileName      = postedFile.FileName;

            string[] excelRetrieveColumns = new string[] { "*" };

            _employeeExcelTemplateFileName = fileProvider.GetFilePathToSave(UPLOAD_PATH_KEY_NAME, fileName);
            string whereQuery = " LEN(Region_Name) >0 ";

            //  postedFile.SaveAs(_employeeExcelTemplateFileName);

            DataControl.Repository.AzureBlobUpload objAzureUpload = new Repository.AzureBlobUpload();
            DataControl.Abstraction.IFileProvider  objPathProv    = new DataControl.Impl.FileSystemProvider();

            string accKey = objPathProv.GetConfigValue("UPLOADEDFILEBLOBACCKEY");

            string blobURL = objAzureUpload.PutAzureBlobStorage(postedFile.InputStream, postedFile.FileName, accKey, containerName);

            System.IO.Stream stream = objAzureUpload.AzureblockDownload(postedFile.FileName, accKey, containerName);
            DataTable        dt     = new DataTable();

            dt = objAzureUpload.ConvertStreamToDataTable(stream, "D_Doctor_Name");
            return(dt);
        }
Esempio n. 5
0
        private DataTable ConvertCCMExcelToDataTable(System.Web.HttpPostedFileBase postedFile)
        {
            IFileProvider fileProvider  = new FileSystemProvider();
            IExcelFactory excelFactory  = new ExcelFactory();
            CurrentInfo   objCurInfo    = new CurrentInfo();
            string        containerName = objCurInfo.GetCompanyCode().ToLower();
            string        fileName      = postedFile.FileName;

            string[] excelRetrieveColumns = new string[] { "Row_No", "Customer_Name", "Sur_Name", "Speciality_Name", "Gender", "Qualification", "Address1",
                                                           "Address2", "Local_Area", "Pin_Code", "City", "State", "Country", "Phone", "Mobile", "Fax", "Email", "Hospital_Name", "Hospital_Classification",
                                                           "DOB", "Anniversary_Date", "Registration_No" };

            _CCMExcelTemplateFileName = fileProvider.GetFilePathToSave(UPLOAD_PATH_KEY_NAME, fileName);
            string whereQuery = " LEN(Customer_Name) >0 ";

            DataControl.Repository.AzureBlobUpload objAzureUpload = new Repository.AzureBlobUpload();
            DataControl.Abstraction.IFileProvider  objPathProv    = new DataControl.Impl.FileSystemProvider();

            string accKey = objPathProv.GetConfigValue("UPLOADEDFILEBLOBACCKEY");

            string blobURL = objAzureUpload.PutAzureBlobStorage(postedFile.InputStream, postedFile.FileName, accKey, containerName);

            System.IO.Stream stream = objAzureUpload.AzureblockDownload(postedFile.FileName, accKey, containerName);
            DataTable        dt     = new DataTable();

            dt = objAzureUpload.ConvertStreamToDataTable(stream, "Customer_Name");
            return(dt);
        }
Esempio n. 6
0
        public ActionResult CreateMovie(ManageMovieViewModel movie, System.Web.HttpPostedFileBase file)
        {
            if (!ModelState.IsValid)
            {
                return(View(movie));
            }
            if (file != null && file.ContentLength > 0)
            {
                var fileName = System.IO.Path.Combine(Request.MapPath("~/Content/Movie/"), System.IO.Path.GetFileName(file.FileName));
                file.SaveAs(fileName);
                movie.Avatar = System.IO.Path.GetFileName(file.FileName);
            }
            //MR_DataClassesDataContext _db = new MR_DataClassesDataContext();
            MRDataEntities _db = new MRDataEntities();

            if ((bool)_db.tbl_UserAccount.SingleOrDefault(u => u.user_Account == CookieHepler.GetCookie("user")).user_IsAdmin)
            {
                movie.Status = 2;
            }
            else
            {
                movie.Status = 0;
            }
            movie.Create = AccountManager.GetId(CookieHepler.GetCookie("user"));
            string newId = MovieManager.CreateMovie(movie);

            return(RedirectToAction("Index", new { id = newId }));
        }
Esempio n. 7
0
 public ActionResult Edit(ManageMovieViewModel model, System.Web.HttpPostedFileBase file)
 {
     if (!ModelState.IsValid)
     {
         return(View(model));
     }
     if (file != null && file.ContentLength > 0)
     {
         var fileName = System.IO.Path.Combine(Request.MapPath("~/Content/Movie/"), System.IO.Path.GetFileName(file.FileName));
         file.SaveAs(fileName);
         model.Avatar = System.IO.Path.GetFileName(file.FileName);
         string oldAvatar = _db.tbl_Movie.SingleOrDefault(m => m.movie_Id == model.Id).movie_Avatar;
         if (oldAvatar != "Movie_Default.png")
         {
             ImageManager.Delete(Server.MapPath("~/Content/Movie/" + oldAvatar));
         }
     }
     else
     {
         //MR_DataClassesDataContext _db = new MR_DataClassesDataContext();
         MRDataEntities _db = new MRDataEntities();
         model.Avatar = _db.tbl_Movie.SingleOrDefault(m => m.movie_Id == model.Id).movie_Avatar;
     }
     MovieManager.Edit(model);
     return(RedirectToAction("Index", new { id = model.Id }));
 }
Esempio n. 8
0
        public ActionResult Upload(System.Web.HttpPostedFileBase file)
        {
            string filename = Server.MapPath("~/files/somename.ext");

            file.SaveAs(filename);
            return(RedirectToAction("Index"));
        }
Esempio n. 9
0
        public ActionResult Create(Food ObjFood, System.Web.HttpPostedFileBase FoodImg)
        {
            string UserType = Session["USERTYPE"].ToString();

            if (UserType != null && UserType == "ADMIN")
            {
                ObjFood.AdminAprovalStatus = 1;
            }
            else
            {
                ObjFood.AdminAprovalStatus = 0;
            }
            if (ObjFood.Save() < 1)
            {
                return(Json(new { msg = "Error in Update Mess" }));
            }
            else if (FoodImg != null)
            {
                FoodImg.SaveAs(System.IO.Path.Combine(Server.MapPath("~/FoodImages/"), ObjFood.FID + ".jpg"));
            }
            if (ObjFood.Food_Image.Equals(""))
            {
                ObjFood.Food_Image = "/FoodImages/" + ObjFood.FID + ".jpg";
                if (ObjFood.Save() < 1)
                {
                    return(Json(new { msg = "Error in Update Food" }));
                }
            }
            return(RedirectToAction("Index"));
        }
Esempio n. 10
0
        public async Task <ActionResult> Upload(System.Web.HttpPostedFileBase postFile)
        {
            var file = FileStorage.Current.CreateUploadFileOption(postFile);
            await FileStorage.Current.UploadAsync(file, postFile.InputStream);

            return(this.RedirectToAction(nameof(Index)));
        }
Esempio n. 11
0
        private ViewModels.FotoVM MontarFoto(System.Web.HttpPostedFileBase file)
        {
            if (file.ContentLength > 1048576) //1MB
            {
                ModelState.AddModelError("", "Arquivo excedeu o limite permitido");
            }

            var      foto       = new ViewModels.FotoVM();
            FileInfo arqEnviado = null;

            arqEnviado = new FileInfo(file.FileName);

            if (arqEnviado != null)
            {
                foto.NomeArquivo     = arqEnviado.Name;
                foto.ExtensaoArquivo = arqEnviado.Extension;
                foto.TipoArquivo     = file.ContentType;
                using (var reader = new BinaryReader(file.InputStream))
                {
                    foto.Binario = reader.ReadBytes(file.ContentLength);
                }
            }

            return(foto);
        }
Esempio n. 12
0
        /// <summary>
        /// 上传Excel导入
        /// </summary>
        /// <param name="file">上载文件对象</param>
        /// <param name="errorMsg">错误信息</param>
        /// <param name="sheetName">表名,默认取第一张</param>
        /// <returns></returns>
        public static DataTable Import(System.Web.HttpPostedFileBase file, ref string errorMsg, string sheetName = "")
        {
            if (file == null || file.InputStream == null || file.InputStream.Length == 0)
            {
                errorMsg = "请选择要导入的Excel文件";
                return(null);
            }
            var excelType = GetExcelFileType(file.FileName);

            if (excelType == null)
            {
                errorMsg = "请选择正确的Excel文件";
                return(null);
            }
            using (var stream = new MemoryStream())
            {
                file.InputStream.Position = 0;
                file.InputStream.CopyTo(stream);
                var dt = ImportExcel(stream, excelType.Value, sheetName);
                if (dt == null)
                {
                    errorMsg = "导入失败,请选择正确的Excel文件";
                }
                return(dt);
            }
        }
Esempio n. 13
0
        public ActionResult CreateCeleb(ManageCelebViewModel celeb, System.Web.HttpPostedFileBase file)
        {
            if (!ModelState.IsValid)
            {
                return(View(celeb));
            }
            if (file != null && file.ContentLength > 0)
            {
                var fileName = System.IO.Path.Combine(Request.MapPath("~/Content/Celeb/"), System.IO.Path.GetFileName(file.FileName));
                file.SaveAs(fileName);
                celeb.Avatar = System.IO.Path.GetFileName(file.FileName);
            }
            if ((bool)_db.tbl_UserAccount.SingleOrDefault(u => u.user_Account == User.Identity.Name).user_IsAdmin)
            {
                celeb.Status = 2;
            }
            else
            {
                celeb.Status = 0;
            }
            celeb.Create = AccountManager.GetId(User.Identity.Name);
            string newId = CelebManager.CreateCeleb(celeb);

            return(RedirectToAction("Edit", new { id = newId }));
        }
Esempio n. 14
0
        public ActionResult EditDB(Smartphone sm, System.Web.HttpPostedFileBase uploadImage)
        {
            if (uploadImage == null)
            {
                sm.Image = db.Smartphones.AsNoTracking().FirstOrDefault(x => x.Id == sm.Id).Image;

                db.Entry(sm).State = EntityState.Modified;
                db.SaveChanges();

                return(View("ViewDataToAdmin", db.Smartphones));
            }

            if (ModelState.IsValid && uploadImage != null)
            {
                byte[] imageData = null;

                using (var binaryReader = new System.IO.BinaryReader(uploadImage.InputStream))
                {
                    imageData = binaryReader.ReadBytes(uploadImage.ContentLength);
                }
                sm.Image = imageData;

                db.Entry(sm).State = EntityState.Modified;
                db.SaveChanges();

                return(View("ViewDataToAdmin", db.Smartphones));
            }

            return(View("EditSmartphoneData", sm));
        }
Esempio n. 15
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="postedFile"></param>
        /// <param name="contentType">指定contentType,会优先采用此contentType</param>
        public Attachment(System.Web.HttpPostedFileBase postedFile, string contentType = null)
        {
            New();//初始化属性默认值
            this.FileLength = postedFile.ContentLength;
            if (!string.IsNullOrEmpty(contentType))
            {
                this.ContentType = contentType;
            }
            else if (!string.IsNullOrEmpty(postedFile.ContentType))
            {
                this.ContentType = postedFile.ContentType;
            }
            else
            {
                this.ContentType = string.Empty;
            }

            if (!string.IsNullOrEmpty(this.ContentType))
            {
                this.ContentType = this.ContentType.Replace("pjpeg", "jpeg");
                this.MediaType   = GetMediaType(this.ContentType);
            }
            else
            {
                this.ContentType = "unknown/unknown";
                this.MediaType   = MediaType.Other;
            }
            if (Path.GetExtension(postedFile.FileName) == "" && this.MediaType == MediaType.Image)
            {
                switch (this.ContentType)
                {
                case "image/jpeg":
                    this.FileName = postedFile.FileName + ".jpg";
                    break;

                case "image/gif":
                    this.FileName = postedFile.FileName + "jpg";
                    break;

                case "image/png":
                    this.FileName = postedFile.FileName + ".png";
                    break;

                default:

                    break;
                }
            }
            else
            {
                this.FileName = postedFile.FileName;
            }
            this.FriendlyFileName = this.FileName.Substring(this.FileName.LastIndexOf("\\") + 1);

            //自动生成用于存储的文件名称
            this.FileName = GenerateFileName(Path.GetExtension(this.FriendlyFileName));

            CheckImageInfo(postedFile.InputStream);
        }
Esempio n. 16
0
 public void AddFile(System.Web.HttpPostedFileBase file, string name = null)
 {
     if (name == null)
     {
         name = "file" + (Files.Count + 1) + System.IO.Path.GetExtension(file.FileName);
     }
     Files.Add(name, file);
 }
Esempio n. 17
0
        public ActionResult Create(MatchResult entity)//文档上传
        {
            string msg = string.Empty;

            if (Request.Files.Count == 2)//前端获取文件选择控件值
            {
                for (int i = 0; i < Request.Files.Count; i++)
                {
                    System.Web.HttpPostedFileBase postedFile = Request.Files[i]; //获取页面选择的文件
                    UploadFiles upFiles = new UploadFiles();
                    msg = upFiles.fileSaveAsResult(postedFile);                  //上传文件
                    if (i == 0)
                    {
                        entity.BasePath     = postedFile.FileName;
                        entity.BaseFullPath = msg;
                    }
                    else
                    {
                        entity.GoldTempPath     = postedFile.FileName;
                        entity.GoldTempFullPath = msg;
                    }
                }
            }
            else
            {
                return(View());
            }
            string currentPerson = GetCurrentPerson();

            entity.CreateTime   = System.DateTime.Now;
            entity.CreatePerson = currentPerson;
            entity.Id           = Result.GetNewId();

            //excel操作
            entity.Vertion = GetVersion();
            entity.Result  = GoldMatch.Make(entity);
            string returnValue = string.Empty;

            if (m_BLL.Create(ref validationErrors, entity))
            {
                return(Redirect("/home/index"));//提示创建成功
            }
            else
            {
                if (validationErrors != null && validationErrors.Count > 0)
                {
                    validationErrors.All(a =>
                    {
                        returnValue += a.ErrorMessage;
                        return(true);
                    });
                }
                LogClassModels.WriteServiceLog(Suggestion.InsertFail + ",对比结果的信息," + returnValue, "对比结果"
                                               ); //写入日志

                return(View());                   //提示插入失败
            }
        }
Esempio n. 18
0
        private HtmlNode DealBase(System.Web.HttpPostedFileBase file)
        {
            var icon = ContentTypeMapping.Instance.ToIcon(file.ContentType, file.FileName);
            var span = new HtmlElement(HtmlTag.Span);

            span.AddClass("icon-fa-text");
            span.Text(file.FileName);
            return(new HtmlNodeContainer(icon.CreateElement(), span));
        }
Esempio n. 19
0
        public ActionResult Upload(System.Web.HttpPostedFileBase arquivo, int codigoParticipante)
        {
            MA_IMAGEM_PARTICIPANTE imagemParticipante = new MA_IMAGEM_PARTICIPANTE();

            JsonResult jsonResult;

            //Verifica se o registro é inválido e se sim, retorna com erro.
            if (arquivo == null)
            {
                jsonResult = Json(new
                {
                    codigo = -1
                }, JsonRequestBehavior.AllowGet);
            }
            else
            {
                if (GestorDeParticipante.VerificarSeParticipanteExiste(codigoParticipante))
                {
                    MemoryStream target = new MemoryStream();
                    arquivo.InputStream.CopyTo(target);

                    //Define o nome do diretório para a imagem do participante
                    String diretorio = @"\\w7v\AspNetSites\mimacherforms\App\Upload" + @"\" + codigoParticipante.ToString();

                    //Cria o diretório para o participante
                    Directory.CreateDirectory(diretorio);

                    //Cria o nome do arquivo a partir do código do participante
                    String nomearquivo = codigoParticipante.ToString() + "." + arquivo.GetType();

                    //Salva o arquivo no diretório
                    arquivo.SaveAs(Path.Combine(diretorio, nomearquivo));

                    //Configura o registro de imagem de participante para ser inserido no banco de dados
                    imagemParticipante.cod_participante = codigoParticipante;
                    imagemParticipante.imagem           = diretorio + nomearquivo;

                    //Salva o registro de imagem do participante
                    GestorDeImagemDeParticipante.InserirImagem(imagemParticipante);

                    jsonResult = Json(new
                    {
                        codigo = codigoParticipante
                    }, JsonRequestBehavior.AllowGet);
                }
                else
                {
                    jsonResult = Json(new
                    {
                        codigo = -1
                    }, JsonRequestBehavior.AllowGet);
                }
            }

            jsonResult.MaxJsonLength = int.MaxValue;
            return(jsonResult);
        }
Esempio n. 20
0
        public byte[] ConvertToBytes(System.Web.HttpPostedFileBase image)
        {
            byte[] imageBytes = null;

            System.IO.BinaryReader reader = new System.IO.BinaryReader(image.InputStream);

            imageBytes = reader.ReadBytes((int)image.ContentLength);

            return(imageBytes);
        }
Esempio n. 21
0
        public JsonResult UploadImage(System.Web.HttpPostedFileBase file)
        {
            var fileName = Repositories.FileManager.SaveBlogImage(file);

            if (string.IsNullOrEmpty(fileName))
            {
                return(JsonNet(Message.Error));
            }
            return(JsonNet(Message.Ok.ToUploadResponse(fileName)));
        }
Esempio n. 22
0
        public string HDpic()                     //首页图片上传
        {
            string upfile = Request.Form["name"]; //取得上传的对象名称

            System.Web.HttpPostedFileBase pstFile = Request.Files["file"];
            UploadFiles upFiles = new UploadFiles();
            string      msg     = upFiles.fileSaveAs(pstFile, upfile);

            return(msg);
        }
Esempio n. 23
0
        public virtual System.Web.Mvc.ActionResult Index(System.Web.HttpPostedFileBase FileUpload)
        {
            //if (FileUpload.ContentLength > 0)
            //{
            //    string PathFile=Server.MapPath("~/FileUpload/"+FileUpload.FileName);

            //    FileUpload.SaveAs(PathFile);
            //}
            return(View());
        }
Esempio n. 24
0
        public string SaveUploadedFile(string rootPath, System.Web.HttpPostedFileBase uploadedFile)
        {
            if (!Directory.Exists(rootPath))
            {
                Directory.CreateDirectory(rootPath);
            }

            string file = rootPath + "\\" + Guid.NewGuid().ToString() + uploadedFileNameSeperator + uploadedFile.FileName;

            uploadedFile.SaveAs(file);
            return(file);
        }
Esempio n. 25
0
 /*METODO PARA GUARDAR EL ARCHIVO*/
 public void SUBIRARCHIVO(string RUTA, System.Web.HttpPostedFileBase _ARCHIVO)
 {
     try
     {//nombre archivo , ruta
         _ARCHIVO.SaveAs(RUTA);
         this.CONFIRMACION = "fichero guardado";
     }
     catch (Exception ex)
     {
         this.error = ex;
     }
 }
        private string ReadPostedFile(System.Web.HttpPostedFileBase file)
        {
            if (file.ContentLength == 0)
            {
                return("");
            }

            BinaryReader b = new BinaryReader(file.InputStream);

            byte[] binData = b.ReadBytes(file.ContentLength);
            b.Dispose();
            return(System.Text.Encoding.UTF8.GetString(binData));
        }
Esempio n. 27
0
        /// <summary>
        /// upload file to server only, won't change db
        /// </summary>
        /// <param name="fileName"></param>
        /// <param name="f"></param>
        public string Write(string fileName, System.Web.HttpPostedFileBase f, params string[] id)
        {
            string extension = System.IO.Path.GetExtension(fileName);

            if (CheckExtensions(extension) || (Scope == StorageScope.OpdRecordAttachment))
            {
                fileName = GetNewFileName(fileName, extension, id);
                string path = System.IO.Path.Combine(Path(id), fileName);
                f.SaveAs(path);
                return(fileName);
            }
            return("");
        }
Esempio n. 28
0
        //public void Write(string id, System.Web.HttpPostedFileBase f) { Write(GuidUtility.Create(GuidUtility.UrlNamespace, id), f); }
        //public void Write(int id, System.Web.HttpPostedFileBase f) { Write(id.ToString(), f); }
        /// <summary>
        /// upload image file to server only, won't change db
        /// </summary>
        /// <param name="fileName"></param>
        /// <param name="f"></param>
        public string Write(string fileName, System.Web.HttpPostedFileBase f)
        {
            string extension = System.IO.Path.GetExtension(fileName);

            if (CheckExtensions(extension))
            {
                fileName = GetNewFileName(fileName, extension);
                string path = System.IO.Path.Combine(Path(), fileName);
                f.SaveAs(path);
                return(fileName);
            }
            return("");
        }
Esempio n. 29
0
        public void EditAirline(Models.Airline airline, System.Web.HttpPostedFileBase file)
        {
            if (file.ContentLength > 0 && (file.ContentType == "image/jpeg" || file.ContentType == "image/png"))
            {
                string filename = Path.GetFileName(file.FileName);
                string filepath = Path.Combine(System.Web.HttpContext.Current.Server.MapPath("~/Content/images/AirlineLogo"), filename);

                file.SaveAs(filepath);

                airline.Logo = "Content/images/AirlineLogo/" + filename;
                airlineRepo.Update(airline);
            }
        }
Esempio n. 30
0
        private string SaveFileImg(System.Web.HttpPostedFileBase httpPostedFile, string idUser)
        {
            if (httpPostedFile == null)
            {
                return("");
            }
            string path     = "/img/productImg";
            string fileName = string.Format("{0}_{1}_{2}", idUser, DateTime.Now.ToString("ddMMyyyy_hhmmss"), httpPostedFile.FileName);
            string fullPath = path + "/" + fileName;

            httpPostedFile.SaveAs(HttpContext.Server.MapPath(fullPath));
            return(fullPath);
        }