468,483 Members | 2,654 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,483 developers. It's quick & easy.

How can I check if file exists?

Expand|Select|Wrap|Line Numbers
  1. <%
  2. Dim objFSO
  3.   Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
  4. If objFSO.FileExists ("yourfile.txt") Then
  5.   Response.Write "File exists"
  6. Else
  7.   Response.Write "File does not exist"
  8. End If
  9. %>
I am trying to modify this code to check for a file using a variable file name so instead of "yourfile.txt" I am looking for "../Audio_Files/("ID").mp3" to present a list of files that exist where ID is the filename from my database.


May 3 '11 #1
2 2548
3,405 Expert 2GB
this shouldn't be a problem, what part is giving you trouble?

May 6 '11 #2
I couldn't figure out how to include the variable ("ID") in the filename but a friend figured it out for me by creating a new filename from the path, the ID, and the extension.

Thanks for your post
May 7 '11 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

13 posts views Thread by Joseph Oget | last post: by
10 posts views Thread by Raymond | last post: by
6 posts views Thread by Alex Chan | last post: by
10 posts views Thread by Ricardo Luceac | last post: by
14 posts views Thread by John Salerno | last post: by
10 posts views Thread by Julia | last post: by
8 posts views Thread by Sweetiecakes | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.