File check in ASP

A

Adrian

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
 
K

Kyle Peterson

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
 
A

Adrian

many thanks

Kyle Peterson said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top