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. General Programming
  3. C#
  4. File.Exists - not finding file on PostBack

File.Exists - not finding file on PostBack

Scheduled Pinned Locked Moved C#
helpquestion
4 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.
  • U Offline
    U Offline
    User 3400231
    wrote on last edited by
    #1

    Hi I'm writing a web app to upload up to 4 images to a folder. I also have a drop-down list so the user can choose whether pic is picture 1, 2, 3 or 4 (to set order on page display). Anyway, when one picture is uploaded the user stays in the form to add more pictures. I clear the DDL and re-populate it depending on which pictures have already been uploaded - i.e if pic 1 has been uploaded, only pic 2, 3 and 4 appear in drop-down. To determine this I use File.Exists but this doesn't seem to be working on a postback (i.e it doesn't find pic1.jpg which I have uploaded. It works however, if I leave the page and then click to add an image later - could this be an issue of the folder not refreshing so it looks like the file doesn't exist or a postback problem? Any ideas would be greatly appreciated. Thanks Lorna

    A 1 Reply Last reply
    0
    • U User 3400231

      Hi I'm writing a web app to upload up to 4 images to a folder. I also have a drop-down list so the user can choose whether pic is picture 1, 2, 3 or 4 (to set order on page display). Anyway, when one picture is uploaded the user stays in the form to add more pictures. I clear the DDL and re-populate it depending on which pictures have already been uploaded - i.e if pic 1 has been uploaded, only pic 2, 3 and 4 appear in drop-down. To determine this I use File.Exists but this doesn't seem to be working on a postback (i.e it doesn't find pic1.jpg which I have uploaded. It works however, if I leave the page and then click to add an image later - could this be an issue of the folder not refreshing so it looks like the file doesn't exist or a postback problem? Any ideas would be greatly appreciated. Thanks Lorna

      A Offline
      A Offline
      Abhijit Jana
      wrote on last edited by
      #2

      Member 3402886 wrote:

      I'm writing a web app

      This is C# Forum. Please post it to ASP.NET Fourm Thanks !!

      cheers, Abhijit My Recent Article : Beginner's Guide to ASP.NET Application Folder

      U 1 Reply Last reply
      0
      • A Abhijit Jana

        Member 3402886 wrote:

        I'm writing a web app

        This is C# Forum. Please post it to ASP.NET Fourm Thanks !!

        cheers, Abhijit My Recent Article : Beginner's Guide to ASP.NET Application Folder

        U Offline
        U Offline
        User 3400231
        wrote on last edited by
        #3

        OK will do, but I am using c# code to do this!

        D 1 Reply Last reply
        0
        • U User 3400231

          OK will do, but I am using c# code to do this!

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          The launguage you use to write ASP.NET applications doesn't matter. Your question falls squarely within the perview of ASP.NET technologies. It has nothing to do with C# at all.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007, 2008

          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