Get filenames in local machine

Discussion in 'C#' started by kaysriram, Jul 18, 2007.

  1. #1
    Hi,

    I want to facilitate the user to browse for a particular folder and when a folder has been selected i want to display all the files in that folder.

    Can anyone guide me on this problem to be solved through ASP.
     
    kaysriram, Jul 18, 2007 IP
  2. ccoonen

    ccoonen Well-Known Member

    Messages:
    1,606
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    160
    #2
    Yup - youse FSO (The FileSystemObject) to iterate and enumerate over physical files on the web-server. - Just remember though that certain permissions must exist - if you can't read or write to X folder... then you will have to ask your Host or whoever controls your hosting for the appropriate permissions
     
    ccoonen, Aug 2, 2007 IP
  3. shafferb1

    shafferb1 Peon

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I don't think that with ASP you will be able to do this on a local machine because of security issues. You would have to use a client-side language.

    (Prepared to be corrected :) )

    Ben Shaffer
     
    shafferb1, Aug 14, 2007 IP
  4. KowDot

    KowDot Peon

    Messages:
    296
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Yep.
    [vb.net]
    For Each sFile As String In System.IO.Directory.GetFiles(Context.Request.MapPath("~/YourDirectoryPath"))
    System.IO.File.Delete(sFile)'This would delete all files!!! Obviously don't do this!
    Next

    However as correctly suggested you'll need client side script to browse locally
     
    KowDot, Aug 17, 2007 IP