Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP FTP functions

Status
Not open for further replies.

MrBelfry

IS-IT--Management
May 21, 2003
289
Hi there

I'm trying to upload a file to a remote server using PHP's FTP functions. Here is my code:
Code:
$conn = ftp_connect($ftpserver);
$login = ftp_login($conn, $username,$password);
// upload the file
$destination = "/[URL unfurl="true"]www/images/events/$filename";[/URL]
$source = getcwd() . '\\flyerpics\\' . $filename;
$upload = ftp_put($conn, $destination, $source, FTP_BINARY);
ftp_close($conn);
Unfortunately the file is not uploading properly. The filename appears on my server but it's file size is 0. I also get the following message
Code:
Warning: ftp_put() [function.ftp-put]: PORT command successful
Please help! I've tried setting the time out to 0 and I've tried setting the upload mode to FTP_ASCII but it didn't seem to make any difference. I'm using Win2k, Apache and PHP 4.3.1 on my local machine and a LAMP configuration on the remote.

Thanks

MrBelfry
 
Can you:
echo $destination and $source
and
The return values from the connect, login and put commands please.
Also do you have write permissions to the target directory.
Have you tried do it from the command line on the server where the php runs ?
 
so you just have to make sure port 22 and 23 are open then ?(my question to you )
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top