Solved

Check File Exist

Posted on 2000-04-11
2
189 Views
Last Modified: 2013-12-24
Hi,

  I would like to know  how i can check the existence of a file in a local machine.

  my case, i have an input box (file)
which let user upload a file, but i am afraid user will just any how type a filename and then upload it. This will cause an error page. So I would like to check the existence of the file before I do the uploading.
0
Comment
Question by:seahpc
2 Comments
 
LVL 1

Accepted Solution

by:
ruifranco earned 100 total points
ID: 2707716
You can't. That would cause major security problems, so all you can do is check files in the server.

You can, however, filter the file type the user tries to send (ACCEPT field)and you can also check if something has been uploades to the server and what has been uploaded.
0
 

Expert Comment

by:Xavi053000
ID: 2863523
For the existence of a file use the Fileexists(file) function. And too the path of the file with expandpath(file).

i.e: <cfset file = "/images/" & #prod.nr# & ".gif">
<cfif Fileexists(expandpath(file))>
.....
</cfif>
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question