Beispiel #1
0
        public override HttpPostedFileBase Get(int index)
        {
            HttpPostedFile file = w.Get(index);

            if (file == null)
            {
                return(null);
            }

            return(new HttpPostedFileWrapper(file));
        }
Beispiel #2
0
		public void PopulateTree(CompositeNode root, HttpFileCollection fileCollection)
		{
			foreach (String key in fileCollection.Keys)
			{
				if (key == null) continue;

				HttpPostedFile value = fileCollection.Get(key);

				if (value == null) continue;

				ProcessNode(root, typeof (HttpPostedFile), key, value);
			}
		}
        public void SaveUploadedFile(HttpFileCollection httpFileCollection)
        {
            bool isSavedSuccessfully = true;
            string fName = "";
            foreach (string fileName in httpFileCollection)
            {
                HttpPostedFile file = httpFileCollection.Get(fileName);
                //Save file content goes here
                fName = file.FileName;
                if (file != null && file.ContentLength > 0)
                {

                    var originalDirectory = new DirectoryInfo(string.Format("{0}Images\\WallImages", Server.MapPath(@"\")));

                    string pathString = System.IO.Path.Combine(originalDirectory.ToString(), "imagepath");

                    var fileName1 = Path.GetFileName(file.FileName);


                    bool isExists = System.IO.Directory.Exists(pathString);

                    if (!isExists)
                        System.IO.Directory.CreateDirectory(pathString);

                    var path = string.Format("{0}\\{1}", pathString, file.FileName);
                    file.SaveAs(path);

                }

            }

            //if (isSavedSuccessfully)
            //{
            //    return Json(new { Message = fName });
            //}
            //else
            //{
            //    return Json(new { Message = "Error in saving file" });
            //}
        }
Beispiel #4
0
 public override HttpPostedFileBase Get(int index)
 {
     return(new HttpPostedFileWrapper(w.Get(index)));
 }
        public override HttpPostedFileBase Get(int index)
        {
            HttpPostedFile file = _collection.Get(index);

            return((file != null) ? new HttpPostedFileWrapper(file) : null);
        }