|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Hi,
I have the following code: PHP Code:
Now the issue is - that I know there are files in the FTP server and I can connect to it fine - the problem is when I try to list them out I get: Warning: Variable passed to each() is not an array or object in PAGE on line 198 Using PHP 4.3.2 - when I connect through an FTP client I can see the file fine. print_r($contents); does not return anything - so it seems that $contents is not receiving the array from ftp_nlist I have tried also ftp_rawlist. Plz a little bit of guidance with debugging this would be great E ![]()
__________________
_________________________ Triangle Solutions Ltd http://www.triangle-solutions.com/ |
|
#2
|
||||
|
||||
|
sure your FTP client is taking you to eactly the same path? i.e. /
|
|
#3
|
|||
|
|||
|
Here is the session log of WS_FTP LE that I use when I connect to this host.
Now it says - 257 "/" is current directory. It also goes on about PASSIVE mode and I did try and put this in but that shouldnt make a difference. PHP Code:
|
|
#4
|
||||
|
||||
|
I've tried it on my ISP's FTP server and it works fine.
|
|
#5
|
|||
|
|||
|
Great that helps :)
Can you post the code you wrote - can it be something in php.in I have checked this out also and FTP is enabled.
Anymore takers? |
|
#6
|
||||
|
||||
|
same code just added my ftp host, username and password
here's my output //httpsdocs //httpdocs //error_docs //cgi-bin //cert //anon_ftp //bin //conf //logs //pd //web_users //webstat //webstat-ssl //ftpstat |
|
#7
|
||||
|
||||
|
just before the foreach loop add:
echo $contents; and tell me what it says, it shoulds say array() |
|
#8
|
|||
|
|||
|
Yeah thats what I said I did I used - print_r($contents);
No luck so it seems it is not finding anything I have tried my own server also and different paths but NADA - must be something simple E ![]() |
|
#9
|
|||
|
|||
|
BTW I just tested it on my server and it works - so the code is not at fault - it is something to do with connecting from my local machine that is having an effect - not I can use a client and connect ok I am not behind a proxy or anything so whats the trick?
|
|
#10
|
||||
|
||||
|
my thoughts
your code is ok, it works for me getting nothing with print_r($contents); suggests its finding nothing in the path, hence not creating the array, which will give your foreach() error. I believe you have a path problem. |
|
#11
|
|||
|
|||
|
Thing is I can connect to the FTP server with my local through PHP fine - but just cant get a listing - so is it the PHP I am using 4.3.2 - what php are you using? My server is an older version?
|
|
#12
|
||||
|
||||
|
4.3.1
try putting in an ftp_chdir($conn_id,"/"); just to make sure |
|
#13
|
|||
|
|||
did that already no goodBaffled is the word.... can you update your php easily? Bit lame though blaming that but it may be something in the php.ini? |
|
#14
|
||||
|
||||
|
maybe its your ISP?
|
|
#15
|
|||
|
|||
|
I thought that but I can connect through a WSFTP LE - wouldnt the ISP also block that as it is virtually the same thing going on?
But like I said I can connect to the servers just not get an array back with the file listings? |
![]() |
| Viewing: Dev Shed Forums > System Administration > FTP Help > FTP rawlist issue |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
Linear Mode![]() |