---
title: "if file exists then blaha"
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/87790-if-file-exists-then-blaha"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "qu@ro"
published: "2003-10-06T08:31:31.000Z"
updated: "2003-10-06T09:32:03.000Z"
replies: 3
views: 253
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/asp/87790-if-file-exists-then-blaha"
---

# if file exists then blaha

## #1 — qu@ro, 2003-10-06T08:31Z

om en fil existerar i roten vill jag redirecta till en annan sida, hur skriver jag för att korrekt kolla om filen existerar?
typ, if file a = true then annansida.asp?!

Permalänk: https://www.webforum.nu/p/87790

## #2 — m_soderlund, 2003-10-06T08:37Z

Kan detta fungera?

```
<%
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject") 

if fso.FileExists(fso.GetFile("c:/dokument/fil.txt")) then
Response.Redirect("sida.asp")
end if

set fso = nothing
%>
```

Permalänk: https://www.webforum.nu/p/1178437

## #3 — qu@ro, 2003-10-06T09:17Z

nå, i slutändan:

Dim fso
Set fso = CreateObject("Scripting.FileSystemObject") 
if fso.FileExists(Server.MapPath("/fil")) then
	Response.Redirect("annansida.asp")
end if
set fso = nothing

/tusen tack

Permalänk: https://www.webforum.nu/p/1178476

## #4 — m_soderlund, 2003-10-06T09:32Z

np :bire :)

Permalänk: https://www.webforum.nu/p/1178483

---

Tråden på webben: https://www.webforum.nu/amne/asp/87790-if-file-exists-then-blaha
