[thelist] PHP FTP download Snippet

CDitty mail at redhotsweeps.com
Sat Aug 31 23:38:01 CDT 2002


Thank Anthony.  To be honest, I don't know what I am doing.  :)  This is
bits and pieces that I have put together in hopes that it would work.

At 11:16 PM 8/31/2002, you wrote:
>At 04:29 PM 8/31/2002, CDitty wrote:
>>Hello all,
>>
>>Hope everyone has an excellent holiday weekend.  I am writing a small php
>>script that connects via ftp to a site and will download a certain file.  I
>>have figured out the connection part, but I cannot get the download section
>>to work like I need.  Can anyone look at my code and see what's
>>wrong?  Currently, my file is filled with "1"s.
>
>Chris....
>
>I'm trying to read your code and I'm not understanding what you are trying
>to do. If all you are attempting to do is download, via FTP a specific
>file, I think this code is over designed.
>
>>         $ret = ftp_get($fp, $filename, $filename, FTP_ASCII);
>
>This should not return until done, since it is not an async function.
>Therefore this next line is not needed.
>
>>         while ($ret == FTP_MOREDATA) {
>
>And I am confused here as to why you are attempting to open the local file
>for writing before the download is completed, if you beleived that the
>ftp_get was async.

I ran into problems writing the file.  I thought that maybe I needed to
create the file
on my end before I opened it.




More information about the thelist mailing list