File check in ASP

Discussion in 'ASP General' started by Adrian, Jan 5, 2006.

  1. Adrian

    Adrian Guest

    hi
    I'm writing, or trying to! an ASP page that checks if a file exists and if
    so transfers it. the use sends a query string with the name of the file, I
    have this bit working, but need to check if the path and or file exists in
    vb6 I would write

    if dir(strFileName & "\test.zip")) <>"" then
    msgbox("OK 1 ")
    else
    msgbox("OK 2 ")
    end if
    In VBS for ASP?
    if dir(Server.MapPath(strFileName & "\test.zip")) <>"" then
    response.write ("OK 1 ")
    else
    response.write ("OK 2 ")
    end if
    Adrian, Jan 5, 2006
    #1
    1. Advertising

  2. in ASP/VBScript to check if a file exists use code like this
    (change your file path accordingly.. this is an example from one of my
    projects)

    Dim fsoObject
    Set fsoObject = CreateObject("Scripting.FileSystemObject")
    If fsoObject.FileExists(UploadDirectory & "\Cat1_" & Request("Cat1_ID") &
    ".jpg") Then
    ' do whatever
    End If
    Set fsoObject = Nothing


    "Adrian" <> wrote in message
    news:dpjjnr$d4v$-infra.bt.com...
    > hi
    > I'm writing, or trying to! an ASP page that checks if a file exists and if
    > so transfers it. the use sends a query string with the name of the file,
    > I have this bit working, but need to check if the path and or file exists
    > in vb6 I would write
    >
    > if dir(strFileName & "\test.zip")) <>"" then
    > msgbox("OK 1 ")
    > else
    > msgbox("OK 2 ")
    > end if
    > In VBS for ASP?
    > if dir(Server.MapPath(strFileName & "\test.zip")) <>"" then
    > response.write ("OK 1 ")
    > else
    > response.write ("OK 2 ")
    > end if
    >
    Kyle Peterson, Jan 5, 2006
    #2
    1. Advertising

  3. Adrian

    Adrian Guest

    many thanks

    "Kyle Peterson" <> wrote in message
    news:...
    > in ASP/VBScript to check if a file exists use code like this
    > (change your file path accordingly.. this is an example from one of my
    > projects)
    >
    > Dim fsoObject
    > Set fsoObject = CreateObject("Scripting.FileSystemObject")
    > If fsoObject.FileExists(UploadDirectory & "\Cat1_" & Request("Cat1_ID") &
    > ".jpg") Then
    > ' do whatever
    > End If
    > Set fsoObject = Nothing
    >
    >
    > "Adrian" <> wrote in message
    > news:dpjjnr$d4v$-infra.bt.com...
    >> hi
    >> I'm writing, or trying to! an ASP page that checks if a file exists and
    >> if so transfers it. the use sends a query string with the name of the
    >> file, I have this bit working, but need to check if the path and or file
    >> exists in vb6 I would write
    >>
    >> if dir(strFileName & "\test.zip")) <>"" then
    >> msgbox("OK 1 ")
    >> else
    >> msgbox("OK 2 ")
    >> end if
    >> In VBS for ASP?
    >> if dir(Server.MapPath(strFileName & "\test.zip")) <>""
    >> then
    >> response.write ("OK 1 ")
    >> else
    >> response.write ("OK 2 ")
    >> end if
    >>

    >
    >
    Adrian, Jan 6, 2006
    #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. Davisro
    Replies:
    1
    Views:
    683
    Michael D. Ober
    Jun 14, 2004
  2. mit
    Replies:
    1
    Views:
    780
    Ramu Pulipati
    Jan 25, 2006
  3. kris
    Replies:
    0
    Views:
    500
  4. kris
    Replies:
    0
    Views:
    461
  5. kris
    Replies:
    1
    Views:
    5,167
Loading...

Share This Page