How check for file on server.

Results 1 to 3 of 3

Thread: How check for file on server.

  1. #1
    Join Date
    Dec 1969

    Default How check for file on server.

    I have a database driven website. While tables are updated by an administrator we don&#039t want anyone trying to access and update their information in them (obvious). We decided that when an administrator downloads the tables they must upload a small file (ex: lock.txt) into table directory. Is there a command or way in asp to check to see if lock.txt is there so a flag can be set that won&#039t allow data access?

  2. #2
    BAHEK Guest

    Default RE: How check for file on server.

    Don&#039t remember exact sintax, but there is a Scripting.FileSystemObject and has a property that you can use.<BR>

  3. #3
    Join Date
    Dec 1969

    Default ask one, answer one--fair??

    Here&#039s an example adapted from the vbscript docs showing you how to check if a file exists. If you&#039re checking to see if lock.txt exists you can use something like:<BR><BR>If ReportFileStatus("drive:/folder/subfolder/lock.txt") Then<BR> &#039tell user he can&#039t table right now.<BR>Else<BR> &#039user updates table<BR>End If<BR><BR>The function returns true if the file exists and false if it does not. It looks like this:<BR><BR>Function ReportFileStatus(filespec)<BR> Dim fso, bol<BR> Set fso = CreateObject("Scripting.FileSystemObject")<BR> If (fso.FileExists(filespec)) Then<BR> bol = True<BR> Else<BR> bol = False<BR> End If<BR> ReportFileStatus = msg<BR>End Function<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts