By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,868 Members | 1,991 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,868 IT Pros & Developers. It's quick & easy.

How can I check if file exists?

P: 2
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
Share this Question
Share on Google+
2 Replies

Expert 2.5K+
P: 3,405
this shouldn't be a problem, what part is giving you trouble?

May 6 '11 #2

P: 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.