473,394 Members | 1,797 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

check if a file exists on an FTP server

Hello,

Using PHP 4, how do you check if a file exists on an FTP server given
its connection information and a directory to check?

Thanks, - Dave

Jul 23 '06 #1
3 31371
<la***********@zipmail.comwrote in message
news:11**********************@s13g2000cwa.googlegr oups.com...
Hello,

Using PHP 4, how do you check if a file exists on an FTP server given
its connection information and a directory to check?

Thanks, - Dave
I think there is none, but maby you could rename it with ftp_rename() to the
same name :-)
I'm doing something with FTP 2.
Jul 23 '06 #2
2 options...

1. Use 'ftp_nlist' to retrieve the list of files, and check to see if
your file is there.

http://www.php.net/manual/en/function.ftp-nlist.php

or

2. Use 'ftp_size' to check the file size of a given file (it will
return -1 if the file doesn't exist).

http://www.php.net/manual/en/function.ftp-size.php

la***********@zipmail.com wrote:
Hello,

Using PHP 4, how do you check if a file exists on an FTP server given
its connection information and a directory to check?

Thanks, - Dave
Jul 23 '06 #3
On Sun, 23 Jul 2006 08:05:45 -0700, la***********@zipmail.com wrote:
Hello,

Using PHP 4, how do you check if a file exists on an FTP server given
its connection information and a directory to check?

Thanks, - Dave
I'd just use fopen, as in
fopen("ftp://user:pa******@example.com/somefile.txt", "r")

Steve

Jul 24 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Raymond | last post by:
Hi All: To find a file exists using the file name, I have tow routings on UNIX system. 1. access(2) 2. lstat(2) This tow function also can do. When the return value is "-1" and errno is...
1
by: szabelin | last post by:
try if(File.Exists(Server.MapPath("filename.xml"))) >-----Original Message----- >HI > >I have an aspx page that imports the System.IO namespace.
11
by: JIM.H. | last post by:
Hello, I am using this to open an excel file: Response.Redirect(http://myServer/Files/myFile.xls) How should I check if the file available first to get rid of error page. Thanks, Jim.
4
by: DEWright_CA | last post by:
I am trying to see if a file exists in a virtual directory, and if so run a method. I try doing File.Exists and the method runs but the file isn't there. Is there a web version of File.Exists or...
7
by: Nathan Sokalski | last post by:
I have a form that allows the user to upload a file. Even though <input type="file" runat="server"> is intended to have the user choose the file using the browse button, it still allows them to...
2
by: Wayne Wengert | last post by:
I am trying to determine if a file exists on a web site but I cannot get a match. I have verified that the file does exists in the specified directory (I verified the case of the file and directory...
5
by: Max | last post by:
hi i have file browser control to select any file and a button to upload file on my web page now when i select any file. now on click of upload button i have check that file exist or no if...
4
by: mc | last post by:
Scenario: I have a database of companys, and a directory of images, each image has the name of one of the companys, although not all companys have images. I want a page which displays the...
4
by: Italian Pete | last post by:
Hi, I have a website sitting on a server (ServerA) with images to be displayed sitting on a separate server (ServerB) on the same network. I am trying to test for the existance of an image...
2
Manikgisl
by: Manikgisl | last post by:
HI. How to check File exists in Web Share C# try { WebRequest request = HttpWebRequest.Create("http://www.microsoft.com/NonExistantFile.aspx"); request.Method = "HEAD"; // Just get...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.