Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How can i delete an image in a folder

How can i delete an image in a folder

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netquestion
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Deepthy P M
    wrote on last edited by
    #1

    I am using vb with asp.Net.i want to delete picture in my folder using code.How can i do this

    _ S S 3 Replies Last reply
    0
    • D Deepthy P M

      I am using vb with asp.Net.i want to delete picture in my folder using code.How can i do this

      _ Offline
      _ Offline
      _AK_
      wrote on last edited by
      #2

      using this code you can delete the file. System.IO.File.Delete("path of the file"); Check about the permissions setting.

      Apurva Kaushal

      1 Reply Last reply
      0
      • D Deepthy P M

        I am using vb with asp.Net.i want to delete picture in my folder using code.How can i do this

        S Offline
        S Offline
        Sun Rays
        wrote on last edited by
        #3

        Hi, string imgFolder = Server.MapPath("folderPath"); string[] imgList = Directory.GetFiles(imgFolder, "*.jpg"); foreach (string img in imgList) { FileInfo imgInfo = new FileInfo(img); if (imgInfo.LastWriteTime < DateTime.Now.AddMinutes(-3)) { imgInfo.Delete(); } }

        Thanks, Sun Rays To get something you must have to try once. My Articles

        1 Reply Last reply
        0
        • D Deepthy P M

          I am using vb with asp.Net.i want to delete picture in my folder using code.How can i do this

          S Offline
          S Offline
          soni uma
          wrote on last edited by
          #4

          System.IO.FileInfo objFileInfo = new System.IO.FileInfo(Server.MapPath(@"../File/") "FileName"); objFileInfo.Delete(); :-D

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups