Ejemplo n.º 1
0
        private async Task UploadPictureToFileSystemAsync(string imagePath)
        {
            var file = Path.Combine(environment.WebRootPath, imagePath);

            using (var fileStream = new FileStream(file, FileMode.Create))
            {
                await UploadedPicture.CopyToAsync(fileStream);
            }
        }
Ejemplo n.º 2
0
        public ActionResult UploadSuccess(UploadedPicture picture, HttpPostedFileBase image)
        {
            string file = Guid.NewGuid().ToString() + Path.GetExtension(image.FileName);

            image.SaveAs(Server.MapPath("/Pictures/") + file);
            picture.Image = file;
            manager.Add(picture);

            return(View(picture));
        }