Page 1 of 1

File() command and fiel not found

Posted: Sun Oct 16, 2005 10:35 am
by gtm
Hello,

I am trying to read the contents of a file into an array using the file() command. The file is on an ftp site which has anonymous access and I can see the contents of the file if I browse to it. When I try to use the file command I get a warning that the file command failed to open stream.

I have used this sort of code before with other ftp sites so I am wondering if the problem is file permissions on the ftp server. If I can see the contents of the file in a brower is still possible the file is protected from the file command?

Any suugestions would be appreciated

Thanks

George

Posted: Sun Oct 16, 2005 10:40 am
by feyd
the ftp server may require login credentials, be they anonymous or not..

Posted: Sun Oct 16, 2005 11:06 am
by gtm
Thanks for the reply.

I have tried to use credentials like

Code: Select all

$fileData = file("ftp://anonymous:gmclean@ftp.ftpsite.edu/filename")
but have not had any success.

Is that what you were suggesting?

Posted: Sun Oct 16, 2005 3:44 pm
by gtm
What file permissions do I need to use the PHP file() command? Do I need write access?

Is there any limit to the file name or what charactersare in the filename? The file on the ftp server I am trying to open is called

mm5_d2.extract.AHRHW.2005081500.f00

Thanks

George

Posted: Sun Oct 16, 2005 3:52 pm
by feyd
it should only need read access via the ftp server.
it appears it should be okay, but you may have some errors that you aren't showing or aren't detecting related to the execution.. may want to research using the ftp commands as well...