Bhavesh Vankar

Bhavesh Vankar

  • 1.2k
  • 875
  • 25.1k

Captured image by webcam store into perticular sub directory

Oct 27 2020 6:29 AM
i have one project i want to save image captured from vebcam and i want to save it in sub directory date wise. like
Images - 27/10/2020.
then how to do it.
i have code like as below.
  1. if (!Directory.Exists(Server.MapPath(MainDir)))  
  2. {  
  3.     Directory.CreateDirectory(Server.MapPath(MainDir));  
  4. }  
  5. if (!Directory.Exists(Server.MapPath(MainDir + SubDir)))  
  6. {  
  7.     Directory.CreateDirectory(Server.MapPath(MainDir + SubDir));  
  8. }  
  9.   
  10. MainDir = SubDir + "/" + Path.GetFileName(vImage.ImageUrl);  
  11. vImage.ImageUrl = (Server.MapPath(MainDir + SubDir));  
 

Answers (2)