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 to delete uploaded file.

How to delete uploaded file.

Scheduled Pinned Locked Moved ASP.NET
sysadmintutorial
7 Posts 3 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.
  • S Offline
    S Offline
    Soniya_k
    wrote on last edited by
    #1

    Hi All !!! I've one image control which displays banner for a shop. On ImageButton- 'Remove Banner', I want to remove that banner image from that image control and from server. Waiting for answer. Thanking You.

    P 1 Reply Last reply
    0
    • S Soniya_k

      Hi All !!! I've one image control which displays banner for a shop. On ImageButton- 'Remove Banner', I want to remove that banner image from that image control and from server. Waiting for answer. Thanking You.

      P Offline
      P Offline
      Parwej Ahamad
      wrote on last edited by
      #2

      OnClick event write below code, set ImageButton.imageUrl path either nothing or defaultimage url it's simple

      Parwej Ahamad

      S 1 Reply Last reply
      0
      • P Parwej Ahamad

        OnClick event write below code, set ImageButton.imageUrl path either nothing or defaultimage url it's simple

        Parwej Ahamad

        S Offline
        S Offline
        Soniya_k
        wrote on last edited by
        #3

        Thanks for replying. But I think you've not understood my question. I want to delete image file which I've uploaded on server. Just I'm using imageButton. I don't want to remove image of imageButton. If u know pls do tell.

        S P 2 Replies Last reply
        0
        • S Soniya_k

          Thanks for replying. But I think you've not understood my question. I want to delete image file which I've uploaded on server. Just I'm using imageButton. I don't want to remove image of imageButton. If u know pls do tell.

          S Offline
          S Offline
          Suman Singh
          wrote on last edited by
          #4

          string delpath = "C:\Inetpub\wwwroot\projects\images\image1.gif"//complete physicalpath of your image if (File.Exists(delpath)) { File.Delete(delpath); } This will delete the file physically from the server... Suman Singh

          S 1 Reply Last reply
          0
          • S Suman Singh

            string delpath = "C:\Inetpub\wwwroot\projects\images\image1.gif"//complete physicalpath of your image if (File.Exists(delpath)) { File.Delete(delpath); } This will delete the file physically from the server... Suman Singh

            S Offline
            S Offline
            Suman Singh
            wrote on last edited by
            #5

            One more thing.. you need to use namespace System.IO; using System.IO;

            1 Reply Last reply
            0
            • S Soniya_k

              Thanks for replying. But I think you've not understood my question. I want to delete image file which I've uploaded on server. Just I'm using imageButton. I don't want to remove image of imageButton. If u know pls do tell.

              P Offline
              P Offline
              Parwej Ahamad
              wrote on last edited by
              #6

              ok, when you are upload file to the server your should define the any specific map path and then check if exist then delete otherwise leave it.

              Parwej Ahamad

              S 1 Reply Last reply
              0
              • P Parwej Ahamad

                ok, when you are upload file to the server your should define the any specific map path and then check if exist then delete otherwise leave it.

                Parwej Ahamad

                S Offline
                S Offline
                Soniya_k
                wrote on last edited by
                #7

                Thank You to both of you - Suman and Parwej

                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