Solved

Check File Exist

Posted on 2000-04-11
2
206 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Database Solutions Engineer FAQs

In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller single-server environments.

Question has a verified solution.

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

Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

617 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