Question:
I am trying to access some PDF files in a database. I give the address of the file in the browser as an IP address. I am trying to create links for these files in a page. Before painting the link, I want to verify whether the link is valid and that the file exists. How can I do this in ASP?
Answer:
Use the FileExists method of the FileSystemObject from ASP to check if the file exists.
Dim fs, strFileNameAndPathstrFileNameAndPath = Your file name' -- Use file name and path ' -- from the database. Remember to map it ' -- to the Web Server's point of view. ' -- Use Server.MapPath for help.Set fs = CreateObject("Scripting.FileSystemObject")If fs.FileExists(strFileNameAndPath) Then ' -- file existselse ' -- file does not existend if
Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.
Related Posts
- Determine who and what Caused a Deadlock in one of your Database Objects
- Leading corporations form alliance for significant industry shift
- Capturing Textboxes Available in a Google Authentification Page Using Selenium
- Virtual Reality Classrooms: The Future of Learning or a Security Nightmare?
- Convert a String to a Number in Python






















