file-exists

Why doesn't file_exists() work?

Here is my PHP code: [root@file htdocs]# vi test.php <?php var_dump(file_exists('/usr/local/apache2/resumes/28/"Chapel Hill"/franky_li/"CV.doc"')); ?> "test.php" [New] 5L, 100C written [root@file htdocs]# php test.php bool(false) which says the file doesn't exists,but in fact it does: [root@file htdocs]# ls -l /usr/local/apache2/r...

PHP's file_exists() will not work for me?

For some reason this PHP code below will not work, I can not figure it out. It is very strange, file_exists does not seem to see that the image does exist, I have checked to make sure a good file path is being inserted into the file_exists function and it is still acting up If I change file_exists to !file_exists it will return an ima...

file_exists() for a file that contains (&) in filename

$filename = "Sara & I.mp3"; if (file_exists($filename)) { ... } If the filename has a "&" PHP does not return true for file_exists How can I escape "&" in the $filename for the file_exists to work? Already tried urlecode(), urlrawencode(), htmlentities(), and escaping the '&' with a backslash (\&)... no go ps. this is on a linux sy...

file_exists() is too slow in PHP. Can anyone suggest a faster alternative?

When displaying images on our website, we check if the file exists with a call to file_exists(). We fall back to a dummy image if the file was missing. However, profiling has shown that this is the slowest part of generating our pages with file_exists() taking up to 1/2 ms per file. We are only testing 40 or so files, but this still pus...

PHP File Exists Always False

I have a case where file_exists() is always returning false. My latest attempt was to just test to see if it would return true for $_SERVER["SCRIPT_FILENAME"] and then return the value of the path if it couldn't find the file which it does. The path while not necessarily relevant to solving the problem is: /Users/joe/Workspace/720/ap...

CPU load with file_exists in php

Hi, i own a site with a high load cpu httpd request per minute. I've noticed i use "file_exists" on each httpd request. Is that function to much heavy? ...

Able to include file in ASP.NET, but not check if it exists.

I want to include certain files in my page. I'm not always sure if they exists, so I have to check if they do. (Otherwise the page crashes, as you probably know) <%@ Page Language="C#" %> <html> <body> <% bool exists; exists = System.IO.File.Exists("/extra/file/test.txt"); %> Test include:<br> <!--#include file="/extra/file/test....

How to check if file exists without the extension in PHP?

I don't want to specify the ".php" file extension in the link. But when I do that I can't successfully check to see if the file specified in the link exists or not. This is because PHP's built in "file_exists" function takes the .php extension in consideration. And even this doesn't work: file_exists($file.".php"); Anyway, is there som...

How can you check if a file exists before including/importing it in JSP?

Assuming that requestScope.importMe is expecting a path to a jsp file <c:choose> <c:when test="${!empty requestScope.importMe && fileExists(requestScope.importMe) }"> <c:import url="${requestScope.importMe}" /> ... How can I check if the file exists before trying to include it so that an error is not thrown? I'd like to ...

Checking if a php process is already running

Hi. I'm trying to check if a process is already running by using a temporal file demo.lock: demo.php: <?php $active=file_exists('demo.lock'); if ($active) { echo 'process already running'; } else { file_put_contents ('demo.lock', 'demo'); sleep(10); //do some job unlink ('demo.lo...

MS-Access nested DIR - check if a file exists elsewhere whilst looping through a folder

I have used the DIR() command in Microsoft Access 2003 to loop through the files in folder A. This works fine, but I need to check if each file also exists in another location (folder B), and only process the file if it doesn't exist in folder B. The problem is that checking for the file existing in folder B also uses the DIR() function...

Files in SQL stored procedure

Hello all, I'm currently tasked with reading some data that stored in a flat file into my database and run reports against it. The one problem I'm running into is checking to see if a file actually exists. Is there a simple function to check if the file exists? Thanks! ...

Variables are not being rewritten as page is processed.

I have a php script that checks to see if a particular file exists. This name of the file is defined by the 'compartment' variable. When the script is copied and pasted again into a separate block, changing only the compartment variable it runs into a problem... Say for example 1.jpeg exists but 2.jpeg doesn't. The first block displays ...

Finding a file with a specific name with any extension.

Please note that I want the compartment number to change. <?php $compartment = "1"; /* HERE I NEED SOME SCRIPT TO FIND THE EXTENSION OF THE FILE NAME $compartment AND TO SAVE THAT AS A VARIABLE NAMED 'EXTENSION'.*/ if (file_exists($compartment.$extension)) { echo "$compartment.$extension exists! } else { ...

PHP check file exists without knowing the extension

Hey All I need to check if a file exists but I don't know the extension. IE I would like to do: if(file_exists('./uploads/filename')): // do something endif; Of course that wont work as it has no extension. the extension will be either jpg, jpeg, png, gif Any ideas of a way of doing this without doing a loop ? Thanks in advance...

How to detect if a file exist in a project folder?

I am having a collection of images in my project folder. how to detect if a image exist in my project folder? I am using c#. Thanks. ...

PHP and file_exists - clarification of a note on the documentation

Hi all. I was checking the documentation for the file_exists() PHP function. The documentation at some point reads: The check is done using the real UID/GID instead of the effective one. What does that mean? I have no idea. Can somebody please explain that to me? Thanks, Daniele ...

Matlab 'exist' returns 0 for a file that definitely exists!

I'm running Matlab 7.8.0 under Windows. I am calling an external utility using dos() which creates a file in the current directory. I the file is created correctly, but it cannot be seen by exist or fopen, which return 0 and -1 respectively. The filename is correct! >> pwd ans = I:\ >> ls file1.asc file2.asc file3.asc >> ex...

SQL 2000: only select records where xp_fileexist = true?

Hi, imagine i have a table called tbl_pictures: picture_id and picture_name and there are about 500 records in that table. The pictures are stored in c:\mypics\ The problem: not all photos exists anymore, but they ARE still in the table. How can i list only those pictures that DO exist? I do know how to check if a single file exists w...