How to check a file at client side

Discussion in 'ASP .Net' started by mhadi, Feb 14, 2004.

  1. mhadi

    mhadi Guest

    Hello
    Please Help me!! The big bossman is screaming in my ear,
    I am only devloper of dotnet in my software house and know only to develop
    widows based application !!

    My boss wan't me to devolope a page so that when a user clicks a link to to
    download a file the page check directory at client side(fixed lets name it
    "c:\download") and search for file say "blablav1.1.exe" (version will be
    updated)

    if file is found then
    dont download it
    else if it is not then
    download the new version and execute it to install

    waiting for quick rescue
    mhadi
     
    mhadi, Feb 14, 2004
    #1
    1. Advertising

  2. mhadi

    Scott M. Guest

    It's no problem to check the client side file system if your clients will be
    IE, you can use the VBScript "FileSystemObject" to check if the file is
    there or not.

    The problem is using the client to cancel the download that has already
    begun at the server level.

    You might want to try having the link point, not to the file for download,
    but to a page that consists of nothing but the code that will check to see
    if the user already has the file. If they do, the page can redirect them
    back to where they came from without doing anything and if they don't, the
    file can redirect them to a page that sends the file down to them.

    Check here for info. on using the FSO (also look at the methods link for the
    "FileExists" method that you will need):

    http://msdn.microsoft.com/library/d...en-us/vbenlr98/html/vaobjfilesystemobject.asp


    "mhadi" <> wrote in message
    news:%...
    > Hello
    > Please Help me!! The big bossman is screaming in my ear,
    > I am only devloper of dotnet in my software house and know only to develop
    > widows based application !!
    >
    > My boss wan't me to devolope a page so that when a user clicks a link to

    to
    > download a file the page check directory at client side(fixed lets name it
    > "c:\download") and search for file say "blablav1.1.exe" (version will be
    > updated)
    >
    > if file is found then
    > dont download it
    > else if it is not then
    > download the new version and execute it to install
    >
    > waiting for quick rescue
    > mhadi
    >
    >
     
    Scott M., Feb 14, 2004
    #2
    1. Advertising

  3. mhadi

    Scott M. Guest

    Here's an old example I dug up...

    <HTML>
    <HEAD>
    <title>Using the FileSystem Object</title>
    </HEAD>

    <BODY>
    <SCRIPT LANGUAGE="VBScript">
    Dim fso, myFile

    Set fso = CreateObject("Scripting.FileSystemObject")

    if fso.FileExists("c:\VBScript.txt") then
    'The number 8 represents the 'ForAppending' constant
    'The 'True' argument says to create the file if it doesn't exsist
    'but in this example, it doesn't matter because we are inside of the
    'true condition that tests if the file exists anyway
    set myFile = fso_OpenTextFile("c:\VBScript.txt",8, True)
    myFile.WriteLine(inputbox("What would you like in your text file?"))
    myFile.WriteLine(date & " - " & navigator.appName)
    myFile.Close
    end if

    '***************************************************************************
    *********

    Dim Drive, AllDrives
    Set fsObj = CreateObject("Scripting.FileSystemObject")
    Set AllDrives = fso.Drives

    For Each Drive in AllDrives

    document.write (Drive.DriveLetter & " - ")

    If Drive.DriveType = 3 Then 'Network Drive
    document.write (Drive.ShareName)
    ElseIf Drive.IsReady Then 'Removable Media with Media Present
    document.write (Drive.VolumeName)
    End If

    document.write("<BR>")
    Next

    Set myFile = nothing
    Set Drives = nothing
    set fso = nothing
    </SCRIPT>
    </BODY>
    </HTML>
     
    Scott M., Feb 14, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt
    Replies:
    2
    Views:
    2,366
    brucie
    Oct 16, 2004
  2. Boss302
    Replies:
    0
    Views:
    1,070
    Boss302
    Nov 21, 2006
  3. Bogdan
    Replies:
    2
    Views:
    668
    Bogdan
    Jun 9, 2008
  4. Zoe Hart
    Replies:
    1
    Views:
    383
    Scott Wisniewski
    Jan 8, 2004
  5. Matt
    Replies:
    3
    Views:
    132
    McKirahan
    Oct 15, 2004
Loading...

Share This Page